@x33025/sveltely 0.0.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 (44) hide show
  1. package/README.md +65 -0
  2. package/dist/actions/motion.d.ts +9 -0
  3. package/dist/actions/motion.js +24 -0
  4. package/dist/actions/portal.d.ts +12 -0
  5. package/dist/actions/portal.js +47 -0
  6. package/dist/components/AnimatedNumber.svelte +18 -0
  7. package/dist/components/AnimatedNumber.svelte.d.ts +8 -0
  8. package/dist/components/Dropdown/Dropdown.svelte +86 -0
  9. package/dist/components/Dropdown/Dropdown.svelte.d.ts +11 -0
  10. package/dist/components/Dropdown/index.d.ts +1 -0
  11. package/dist/components/Dropdown/index.js +1 -0
  12. package/dist/components/GlowEffect.svelte +136 -0
  13. package/dist/components/GlowEffect.svelte.d.ts +11 -0
  14. package/dist/components/NavigationStack/NavigationStack.svelte +69 -0
  15. package/dist/components/NavigationStack/NavigationStack.svelte.d.ts +9 -0
  16. package/dist/components/NavigationStack/SidebarToggle.svelte +40 -0
  17. package/dist/components/NavigationStack/SidebarToggle.svelte.d.ts +9 -0
  18. package/dist/components/NavigationStack/Toolbar.svelte +24 -0
  19. package/dist/components/NavigationStack/Toolbar.svelte.d.ts +8 -0
  20. package/dist/components/NavigationStack/index.d.ts +8 -0
  21. package/dist/components/NavigationStack/index.js +8 -0
  22. package/dist/components/Portal.svelte +6 -0
  23. package/dist/components/Portal.svelte.d.ts +20 -0
  24. package/dist/components/Sheet/Sheet.svelte +66 -0
  25. package/dist/components/Sheet/Sheet.svelte.d.ts +13 -0
  26. package/dist/components/Sheet/index.d.ts +1 -0
  27. package/dist/components/Sheet/index.js +1 -0
  28. package/dist/components/Spinner.svelte +7 -0
  29. package/dist/components/Spinner.svelte.d.ts +6 -0
  30. package/dist/components/TabView/Tab.svelte +52 -0
  31. package/dist/components/TabView/Tab.svelte.d.ts +11 -0
  32. package/dist/components/TabView/TabPanel.svelte +32 -0
  33. package/dist/components/TabView/TabPanel.svelte.d.ts +9 -0
  34. package/dist/components/TabView/TabView.svelte +38 -0
  35. package/dist/components/TabView/TabView.svelte.d.ts +10 -0
  36. package/dist/components/TabView/index.d.ts +8 -0
  37. package/dist/components/TabView/index.js +7 -0
  38. package/dist/components/TextShimmer.svelte +60 -0
  39. package/dist/components/TextShimmer.svelte.d.ts +10 -0
  40. package/dist/index.d.ts +10 -0
  41. package/dist/index.js +10 -0
  42. package/dist/style/index.css +30 -0
  43. package/dist/style.css +825 -0
  44. package/package.json +69 -0
@@ -0,0 +1,66 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte';
3
+ import { portal } from '../../actions/portal';
4
+ interface Props {
5
+ open?: boolean;
6
+ label?: string;
7
+ onClose?: () => void;
8
+ class?: string;
9
+ header?: Snippet;
10
+ footer?: Snippet;
11
+ children?: Snippet;
12
+ }
13
+
14
+ let {
15
+ open = $bindable(false),
16
+ label = 'Dialog',
17
+ onClose,
18
+ class: className = '',
19
+ header,
20
+ footer,
21
+ children
22
+ }: Props = $props();
23
+
24
+ function close() {
25
+ if (!open) return;
26
+ open = false;
27
+ onClose?.();
28
+ }
29
+
30
+ $effect(() => {
31
+ if (!open) return;
32
+ const onKey = (event: KeyboardEvent) => {
33
+ if (event.key === 'Escape') close();
34
+ };
35
+ window.addEventListener('keydown', onKey);
36
+ return () => window.removeEventListener('keydown', onKey);
37
+ });
38
+ </script>
39
+
40
+ {#if open}
41
+ <div class="center fixed inset-0 z-50 flex" use:portal>
42
+ <div class="absolute inset-0 bg-black/20 backdrop-blur-sm" on:click|self={close}></div>
43
+ <section
44
+ role="dialog"
45
+ aria-modal="true"
46
+ aria-label={label}
47
+ class="relative z-10 flex max-h-full w-full flex-col overflow-hidden rounded-2xl bg-white shadow-2xl ring-1 ring-zinc-950/10 {className}"
48
+ >
49
+ {#if header}
50
+ <div class="border-b border-gray-200/70 px-4 py-3 text-sm font-medium text-gray-700">
51
+ {@render header()}
52
+ </div>
53
+ {/if}
54
+ <div class="flex-1 overflow-auto px-4 py-4">
55
+ {#if children}
56
+ {@render children()}
57
+ {/if}
58
+ </div>
59
+ {#if footer}
60
+ <div class="border-t border-gray-200/70 px-4 py-3 text-sm text-gray-600">
61
+ {@render footer()}
62
+ </div>
63
+ {/if}
64
+ </section>
65
+ </div>
66
+ {/if}
@@ -0,0 +1,13 @@
1
+ import type { Snippet } from 'svelte';
2
+ interface Props {
3
+ open?: boolean;
4
+ label?: string;
5
+ onClose?: () => void;
6
+ class?: string;
7
+ header?: Snippet;
8
+ footer?: Snippet;
9
+ children?: Snippet;
10
+ }
11
+ declare const Sheet: import("svelte").Component<Props, {}, "open">;
12
+ type Sheet = ReturnType<typeof Sheet>;
13
+ export default Sheet;
@@ -0,0 +1 @@
1
+ export { default } from './Sheet.svelte';
@@ -0,0 +1 @@
1
+ export { default } from './Sheet.svelte';
@@ -0,0 +1,7 @@
1
+ <script lang="ts">
2
+ import { LoaderIcon } from '@lucide/svelte';
3
+
4
+ let { class: className = '', ...props }: { class?: string } & Record<string, unknown> = $props();
5
+ </script>
6
+
7
+ <LoaderIcon role="status" aria-label="Loading" class="size-4 animate-spin {className}" {...props} />
@@ -0,0 +1,6 @@
1
+ type $$ComponentProps = {
2
+ class?: string;
3
+ } & Record<string, unknown>;
4
+ declare const Spinner: import("svelte").Component<$$ComponentProps, {}, "">;
5
+ type Spinner = ReturnType<typeof Spinner>;
6
+ export default Spinner;
@@ -0,0 +1,52 @@
1
+ <script lang="ts">
2
+ import { getContext } from 'svelte';
3
+ import type { Snippet } from 'svelte';
4
+
5
+ interface Props {
6
+ value: string;
7
+ disabled?: boolean;
8
+ class?: string;
9
+ activeClass?: string;
10
+ children?: Snippet;
11
+ }
12
+
13
+ let {
14
+ value,
15
+ disabled = false,
16
+ class: className = '',
17
+ activeClass = '',
18
+ children
19
+ }: Props = $props();
20
+
21
+ const context = getContext<{
22
+ active: string;
23
+ setActive: (value: string) => void;
24
+ registerTab?: (value: string) => void;
25
+ }>('tabView');
26
+
27
+ const isActive = $derived(context.active === value);
28
+
29
+ $effect(() => {
30
+ context.registerTab?.(value);
31
+ });
32
+
33
+ function handleClick() {
34
+ if (disabled) return;
35
+ context.setActive(value);
36
+ }
37
+ </script>
38
+
39
+ <button
40
+ id={'tab-' + value}
41
+ type="button"
42
+ role="tab"
43
+ aria-selected={isActive}
44
+ aria-controls={'panel-' + value}
45
+ {disabled}
46
+ class="{className} {isActive ? activeClass : ''}"
47
+ onclick={handleClick}
48
+ >
49
+ {#if children}
50
+ {@render children()}
51
+ {/if}
52
+ </button>
@@ -0,0 +1,11 @@
1
+ import type { Snippet } from 'svelte';
2
+ interface Props {
3
+ value: string;
4
+ disabled?: boolean;
5
+ class?: string;
6
+ activeClass?: string;
7
+ children?: Snippet;
8
+ }
9
+ declare const Tab: import("svelte").Component<Props, {}, "">;
10
+ type Tab = ReturnType<typeof Tab>;
11
+ export default Tab;
@@ -0,0 +1,32 @@
1
+ <script lang="ts">
2
+ import { getContext } from 'svelte';
3
+ import type { Snippet } from 'svelte';
4
+
5
+ interface Props {
6
+ value: string;
7
+ class?: string;
8
+ children?: Snippet;
9
+ }
10
+
11
+ let { value, class: className = '', children }: Props = $props();
12
+
13
+ const context = getContext<{
14
+ active: string;
15
+ setActive: (value: string) => void;
16
+ }>('tabView');
17
+
18
+ const isActive = $derived(context.active === value);
19
+ </script>
20
+
21
+ {#if isActive}
22
+ <div
23
+ id={"panel-" + value}
24
+ role="tabpanel"
25
+ aria-labelledby={"tab-" + value}
26
+ class={className}
27
+ >
28
+ {#if children}
29
+ {@render children()}
30
+ {/if}
31
+ </div>
32
+ {/if}
@@ -0,0 +1,9 @@
1
+ import type { Snippet } from 'svelte';
2
+ interface Props {
3
+ value: string;
4
+ class?: string;
5
+ children?: Snippet;
6
+ }
7
+ declare const TabPanel: import("svelte").Component<Props, {}, "">;
8
+ type TabPanel = ReturnType<typeof TabPanel>;
9
+ export default TabPanel;
@@ -0,0 +1,38 @@
1
+ <script lang="ts">
2
+ import { setContext } from 'svelte';
3
+ import type { Snippet } from 'svelte';
4
+
5
+ interface Props {
6
+ active: string;
7
+ onChange?: (value: string) => void;
8
+ tabs?: Snippet;
9
+ panels?: Snippet;
10
+ }
11
+
12
+ let { active = $bindable(), onChange, tabs, panels }: Props = $props();
13
+
14
+ function setActive(value: string) {
15
+ if (active === value) return;
16
+ active = value;
17
+ onChange?.(value);
18
+ }
19
+
20
+ setContext('tabView', {
21
+ get active() {
22
+ return active;
23
+ },
24
+ setActive
25
+ });
26
+ </script>
27
+
28
+ {#if tabs}
29
+ <div role="tablist">
30
+ {@render tabs()}
31
+ </div>
32
+ {/if}
33
+
34
+ {#if panels}
35
+ <div>
36
+ {@render panels()}
37
+ </div>
38
+ {/if}
@@ -0,0 +1,10 @@
1
+ import type { Snippet } from 'svelte';
2
+ interface Props {
3
+ active: string;
4
+ onChange?: (value: string) => void;
5
+ tabs?: Snippet;
6
+ panels?: Snippet;
7
+ }
8
+ declare const TabView: import("svelte").Component<Props, {}, "active">;
9
+ type TabView = ReturnType<typeof TabView>;
10
+ export default TabView;
@@ -0,0 +1,8 @@
1
+ import TabViewRoot from './TabView.svelte';
2
+ import Tab from './Tab.svelte';
3
+ import TabPanel from './TabPanel.svelte';
4
+ declare const TabView: typeof TabViewRoot & {
5
+ Tab: typeof Tab;
6
+ Panel: typeof TabPanel;
7
+ };
8
+ export default TabView;
@@ -0,0 +1,7 @@
1
+ import TabViewRoot from './TabView.svelte';
2
+ import Tab from './Tab.svelte';
3
+ import TabPanel from './TabPanel.svelte';
4
+ const TabView = TabViewRoot;
5
+ TabView.Tab = Tab;
6
+ TabView.Panel = TabPanel;
7
+ export default TabView;
@@ -0,0 +1,60 @@
1
+ <script lang="ts">
2
+ interface Props {
3
+ text: string;
4
+ as?: keyof HTMLElementTagNameMap;
5
+ class?: string;
6
+ duration?: number;
7
+ spread?: number;
8
+ }
9
+
10
+ let { text, as = 'span', class: className = '', duration = 2, spread = 2 }: Props = $props();
11
+
12
+ let dynamicSpread = $derived(text.length * spread);
13
+ </script>
14
+
15
+ <svelte:element
16
+ this={as}
17
+ class="text-shimmer {className}"
18
+ style="--spread: {dynamicSpread}px; animation-duration: {duration}s; background-image: var(--bg), linear-gradient(var(--base-color), var(--base-color));"
19
+ >
20
+ {text}
21
+ </svelte:element>
22
+
23
+ <style>
24
+ @keyframes shimmer {
25
+ 0% {
26
+ background-position: 100% center;
27
+ }
28
+ 100% {
29
+ background-position: 0% center;
30
+ }
31
+ }
32
+
33
+ :global(.text-shimmer) {
34
+ position: relative;
35
+ display: inline-block;
36
+ width: max-content;
37
+ max-width: 100%;
38
+ background-size:
39
+ 250% 100%,
40
+ auto;
41
+ background-clip: text;
42
+ -webkit-background-clip: text;
43
+ color: transparent;
44
+ --base-color: #a1a1aa;
45
+ --base-gradient-color: #000;
46
+ background-repeat: no-repeat, padding-box;
47
+ --bg: linear-gradient(
48
+ 90deg,
49
+ #0000 calc(50% - var(--spread)),
50
+ var(--base-gradient-color),
51
+ #0000 calc(50% + var(--spread))
52
+ );
53
+ animation: shimmer linear infinite;
54
+ }
55
+
56
+ :global(.dark .text-shimmer) {
57
+ --base-color: #71717a;
58
+ --base-gradient-color: #ffffff;
59
+ }
60
+ </style>
@@ -0,0 +1,10 @@
1
+ interface Props {
2
+ text: string;
3
+ as?: keyof HTMLElementTagNameMap;
4
+ class?: string;
5
+ duration?: number;
6
+ spread?: number;
7
+ }
8
+ declare const TextShimmer: import("svelte").Component<Props, {}, "">;
9
+ type TextShimmer = ReturnType<typeof TextShimmer>;
10
+ export default TextShimmer;
@@ -0,0 +1,10 @@
1
+ export { motion, hover } from './actions/motion';
2
+ export { default as AnimatedNumber } from './components/AnimatedNumber.svelte';
3
+ export { default as GlowEffect } from './components/GlowEffect.svelte';
4
+ export { default as NavigationStack } from './components/NavigationStack';
5
+ export { default as Portal } from './components/Portal.svelte';
6
+ export { default as Sheet } from './components/Sheet';
7
+ export { default as Spinner } from './components/Spinner.svelte';
8
+ export { default as TextShimmer } from './components/TextShimmer.svelte';
9
+ export { default as Dropdown } from './components/Dropdown';
10
+ export { default as TabView } from './components/TabView';
package/dist/index.js ADDED
@@ -0,0 +1,10 @@
1
+ export { motion, hover } from './actions/motion';
2
+ export { default as AnimatedNumber } from './components/AnimatedNumber.svelte';
3
+ export { default as GlowEffect } from './components/GlowEffect.svelte';
4
+ export { default as NavigationStack } from './components/NavigationStack';
5
+ export { default as Portal } from './components/Portal.svelte';
6
+ export { default as Sheet } from './components/Sheet';
7
+ export { default as Spinner } from './components/Spinner.svelte';
8
+ export { default as TextShimmer } from './components/TextShimmer.svelte';
9
+ export { default as Dropdown } from './components/Dropdown';
10
+ export { default as TabView } from './components/TabView';
@@ -0,0 +1,30 @@
1
+ @import 'tailwindcss';
2
+
3
+ @layer base {
4
+ html,
5
+ body {
6
+ @apply size-full overflow-hidden;
7
+ }
8
+ }
9
+
10
+ @layer utilities {
11
+ .layout {
12
+ @apply flex size-full min-h-0 flex-col;
13
+ }
14
+
15
+ .page {
16
+ @apply flex min-h-0 w-full flex-1 flex-col;
17
+ }
18
+
19
+ .center {
20
+ @apply items-center justify-center;
21
+ }
22
+
23
+ .vstack {
24
+ @apply flex min-h-0 flex-1 flex-col;
25
+ }
26
+
27
+ .hstack {
28
+ @apply flex min-h-0 min-w-0 flex-1 flex-row;
29
+ }
30
+ }