@svelte-atoms/core 1.0.0-alpha.30 → 1.0.0-alpha.31
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.
- package/README.md +853 -852
- package/dist/components/accordion/accordion-root.svelte +7 -3
- package/dist/components/accordion/accordion.stories.svelte +7 -82
- package/dist/components/accordion/item/accordion-item-body.svelte +44 -42
- package/dist/components/accordion/item/accordion-item-header.svelte +51 -50
- package/dist/components/accordion/item/accordion-item-indicator.svelte +51 -50
- package/dist/components/accordion/item/accordion-item-root.svelte +66 -65
- package/dist/components/accordion/item/bond.svelte.d.ts +2 -0
- package/dist/components/accordion/item/index.d.ts +3 -0
- package/dist/components/accordion/item/index.js +3 -0
- package/dist/components/accordion/item/motion.svelte.d.ts +15 -0
- package/dist/components/accordion/item/motion.svelte.js +30 -0
- package/dist/components/accordion/item/types.d.ts +7 -24
- package/dist/components/alert/alert-close-button.svelte +66 -70
- package/dist/components/alert/alert-description.svelte +42 -42
- package/dist/components/alert/alert-description.svelte.d.ts +3 -6
- package/dist/components/alert/alert-root.svelte +68 -103
- package/dist/components/alert/alert-root.svelte.d.ts +2 -2
- package/dist/components/alert/alert.stories.svelte +400 -400
- package/dist/components/alert/bond.svelte.d.ts +0 -13
- package/dist/components/alert/bond.svelte.js +0 -32
- package/dist/components/alert/types.d.ts +8 -32
- package/dist/components/atom/html-atom.svelte +261 -261
- package/dist/components/avatar/avatar.stories.svelte +22 -22
- package/dist/components/badge/badge.stories.svelte +12 -12
- package/dist/components/badge/badge.svelte +19 -19
- package/dist/components/breadcrumb/breadcrumb.stories.svelte +5 -5
- package/dist/components/button/button.stories.svelte +27 -27
- package/dist/components/calendar/calendar-day.svelte +101 -96
- package/dist/components/calendar/calendar.stories.svelte +26 -26
- package/dist/components/card/card-body.svelte +39 -39
- package/dist/components/card/card-footer.svelte +41 -41
- package/dist/components/card/card-root.svelte +91 -91
- package/dist/components/card/card.stories.svelte +133 -133
- package/dist/components/checkbox/checkbox.stories.svelte +22 -22
- package/dist/components/checkbox/checkbox.svelte +6 -2
- package/dist/components/collapsible/collapsible.stories.svelte +172 -172
- package/dist/components/combobox/atoms.d.ts +1 -1
- package/dist/components/combobox/atoms.js +1 -1
- package/dist/components/combobox/combobox-root.svelte +65 -65
- package/dist/components/combobox/compobox.stories.svelte +51 -51
- package/dist/components/combobox/index.d.ts +1 -0
- package/dist/components/container/container.stories.svelte +20 -20
- package/dist/components/container/container.svelte.d.ts +1 -1
- package/dist/components/datagrid/datagrid.stories.svelte +72 -72
- package/dist/components/datagrid/tr/bond.svelte.d.ts +4 -2
- package/dist/components/datagrid/tr/bond.svelte.js +9 -7
- package/dist/components/datagrid/tr/datagrid-tr.svelte +90 -88
- package/dist/components/date-picker/date-picker-calendar.svelte +67 -67
- package/dist/components/date-picker/date-picker-root.svelte +95 -95
- package/dist/components/date-picker/date-picker.stories.svelte +35 -35
- package/dist/components/dialog/bond.svelte.d.ts +13 -3
- package/dist/components/dialog/bond.svelte.js +66 -5
- package/dist/components/dialog/dialog-content.svelte +44 -62
- package/dist/components/dialog/dialog-root.svelte +91 -110
- package/dist/components/dialog/dialog.stories.svelte +64 -64
- package/dist/components/dialog/motion.svelte.d.ts +13 -0
- package/dist/components/dialog/motion.svelte.js +44 -0
- package/dist/components/drawer/attachments.svelte.d.ts +1 -1
- package/dist/components/drawer/attachments.svelte.js +1 -3
- package/dist/components/drawer/bond.svelte.d.ts +24 -5
- package/dist/components/drawer/bond.svelte.js +77 -11
- package/dist/components/drawer/drawer-content.svelte +6 -14
- package/dist/components/drawer/drawer.stories.svelte +27 -95
- package/dist/components/drawer/index.d.ts +2 -0
- package/dist/components/drawer/index.js +2 -0
- package/dist/components/drawer/motion.d.ts +15 -0
- package/dist/components/drawer/motion.js +28 -0
- package/dist/components/dropdown/atoms.d.ts +1 -1
- package/dist/components/dropdown/atoms.js +1 -1
- package/dist/components/dropdown/bond.svelte.d.ts +5 -1
- package/dist/components/dropdown/dropdown-root.svelte +59 -59
- package/dist/components/dropdown/dropdown.stories.svelte +80 -80
- package/dist/components/dropdown/index.d.ts +1 -0
- package/dist/components/form/form.stories.svelte +96 -96
- package/dist/components/image/image.stories.svelte +20 -20
- package/dist/components/input/input.stories.svelte +35 -35
- package/dist/components/label/label.stories.svelte +15 -15
- package/dist/components/lazy/lazy.stories.svelte +28 -28
- package/dist/components/link/link.stories.svelte +15 -15
- package/dist/components/list/list-item.svelte +20 -20
- package/dist/components/menu/atoms.d.ts +1 -0
- package/dist/components/menu/atoms.js +1 -0
- package/dist/components/menu/index.d.ts +2 -1
- package/dist/components/menu/index.js +1 -1
- package/dist/components/menu/menu-item.svelte +69 -51
- package/dist/components/menu/menu-item.svelte.d.ts +1 -0
- package/dist/components/menu/menu.stories.svelte +33 -33
- package/dist/components/popover/bond.svelte.d.ts +20 -7
- package/dist/components/popover/bond.svelte.js +80 -27
- package/dist/components/popover/motion.d.ts +6 -0
- package/dist/components/popover/motion.js +56 -0
- package/dist/components/popover/popover-arrow.svelte +111 -111
- package/dist/components/popover/popover-content.svelte +34 -72
- package/dist/components/popover/popover-indicator.svelte +44 -44
- package/dist/components/popover/popover-root.svelte +48 -48
- package/dist/components/popover/popover.stories.svelte +3 -3
- package/dist/components/popover/types.d.ts +9 -7
- package/dist/components/portal/active-portal.svelte +29 -22
- package/dist/components/portal/active-portal.svelte.d.ts +2 -9
- package/dist/components/portal/portal-root.svelte +76 -83
- package/dist/components/portal/portal-root.svelte.d.ts +4 -6
- package/dist/components/portal/teleport.svelte +49 -50
- package/dist/components/portal/teleport.svelte.d.ts +3 -4
- package/dist/components/qr-code/qr-code.stories.svelte +18 -18
- package/dist/components/radio/radio-group.stories.svelte +41 -41
- package/dist/components/radio/radio.stories.svelte +17 -17
- package/dist/components/radio/radio.svelte +1 -1
- package/dist/components/radio/types.d.ts +98 -0
- package/dist/components/radio/types.js +2 -0
- package/dist/components/root/root.svelte +13 -30
- package/dist/components/root/root.svelte.d.ts +1 -1
- package/dist/components/scrollable/scrollable-root.svelte.d.ts +2 -2
- package/dist/components/scrollable/scrollable.stories.svelte +116 -116
- package/dist/components/sidebar/index.d.ts +2 -0
- package/dist/components/sidebar/index.js +2 -0
- package/dist/components/sidebar/motion.svelte.d.ts +11 -0
- package/dist/components/sidebar/motion.svelte.js +16 -0
- package/dist/components/sidebar/sidebar-content.svelte +3 -13
- package/dist/components/sidebar/sidebar-root.svelte +39 -39
- package/dist/components/sidebar/sidebar.stories.svelte +43 -43
- package/dist/components/sidebar/types.d.ts +2 -12
- package/dist/components/tabs/tabs.stories.svelte +56 -56
- package/dist/components/textarea/atoms.d.ts +1 -0
- package/dist/components/textarea/atoms.js +1 -0
- package/dist/components/textarea/textarea-input.svelte +9 -6
- package/dist/components/textarea/textarea-root.svelte +9 -9
- package/dist/components/textarea/textarea-root.svelte.d.ts +2 -0
- package/dist/components/tooltip/tooltip-trigger.svelte +2 -2
- package/dist/components/tooltip/tooltip-trigger.svelte.d.ts +1 -0
- package/dist/components/tooltip/tooltip.stories.svelte +32 -32
- package/dist/components/tree/tree.stories.svelte +142 -142
- package/dist/icons/icon-copy.svelte +6 -0
- package/dist/{components/radio/types.svelte.d.ts → icons/icon-copy.svelte.d.ts} +3 -3
- package/dist/utils/markdown-to-llm.d.ts +28 -0
- package/dist/utils/markdown-to-llm.js +76 -0
- package/package.json +1 -2
- package/dist/components/radio/types.svelte +0 -0
- package/llm/composition.md +0 -395
- package/llm/crafting.md +0 -838
- package/llm/motion.md +0 -970
- package/llm/philosophy.md +0 -23
- package/llm/preset-variant-integration.md +0 -516
- package/llm/preset.md +0 -383
- package/llm/styling.md +0 -216
- package/llm/usage.md +0 -46
- package/llm/variants.md +0 -1259
|
@@ -1,116 +1,116 @@
|
|
|
1
|
-
<script module>
|
|
2
|
-
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
-
import { Scrollable as Scrollable_ } from '.';
|
|
4
|
-
import { animate } from 'motion';
|
|
5
|
-
import { ScrollableBond } from './bond.svelte';
|
|
6
|
-
import { on } from '../../attachments/event.svelte';
|
|
7
|
-
|
|
8
|
-
const { Story } = defineMeta({
|
|
9
|
-
title: 'ATOMS/Scrollable'
|
|
10
|
-
});
|
|
11
|
-
</script>
|
|
12
|
-
|
|
13
|
-
<Story name="Scrollable">
|
|
14
|
-
{#snippet children({ args })}
|
|
15
|
-
<div class="h-full w-full flex-1">
|
|
16
|
-
<Scrollable_.Root
|
|
17
|
-
class="border-border box-border flex min-h-full w-full rounded-lg border shadow-inner"
|
|
18
|
-
open={false}
|
|
19
|
-
{@attach (node) => {
|
|
20
|
-
const scrollable = ScrollableBond.get();
|
|
21
|
-
if (!scrollable) return;
|
|
22
|
-
|
|
23
|
-
const c1 = on('pointerenter', () => {
|
|
24
|
-
scrollable.state.props.open = true;
|
|
25
|
-
})(node);
|
|
26
|
-
|
|
27
|
-
const c2 = on('pointerleave', () => {
|
|
28
|
-
scrollable.state.props.open = false;
|
|
29
|
-
})(node);
|
|
30
|
-
|
|
31
|
-
return () => {
|
|
32
|
-
c1();
|
|
33
|
-
c2();
|
|
34
|
-
};
|
|
35
|
-
}}
|
|
36
|
-
>
|
|
37
|
-
{#snippet children({ scrollable })}
|
|
38
|
-
<Scrollable_.Container class="max-h-[100svh]">
|
|
39
|
-
<Scrollable_.Content>
|
|
40
|
-
<div class="mx-auto w-[600px] p-4">
|
|
41
|
-
<h3 class="mb-4 text-lg font-semibold">Scrollable Content (New API)</h3>
|
|
42
|
-
<div class="grid grid-cols-3 gap-4">
|
|
43
|
-
{#each Array(99) as _, i}
|
|
44
|
-
<div class="rounded border p-4 shadow">
|
|
45
|
-
<h4 class="font-medium">Card {i + 1}</h4>
|
|
46
|
-
<p class="mt-2 text-sm">
|
|
47
|
-
This is some sample content in card {i + 1}. You can scroll horizontally and
|
|
48
|
-
vertically to see more content.
|
|
49
|
-
</p>
|
|
50
|
-
</div>
|
|
51
|
-
{/each}
|
|
52
|
-
</div>
|
|
53
|
-
|
|
54
|
-
<div class="bg-foreground/10 mt-6 rounded p-4">
|
|
55
|
-
<p class="text-sm">
|
|
56
|
-
This content area is larger than the container, so you can scroll both
|
|
57
|
-
horizontally and vertically using the custom scrollbars or mouse wheel.
|
|
58
|
-
</p>
|
|
59
|
-
</div>
|
|
60
|
-
|
|
61
|
-
<div class="mt-4 flex gap-2">
|
|
62
|
-
<button
|
|
63
|
-
class="rounded bg-blue-500 px-3 py-2 hover:bg-blue-600"
|
|
64
|
-
onclick={() => scrollable.scrollTo(0, 0)}
|
|
65
|
-
>
|
|
66
|
-
Scroll to Top
|
|
67
|
-
</button>
|
|
68
|
-
<button
|
|
69
|
-
class="rounded bg-green-500 px-3 py-2 hover:bg-green-600"
|
|
70
|
-
onclick={() => scrollable.scrollBy(50, 50)}
|
|
71
|
-
>
|
|
72
|
-
Scroll +50px
|
|
73
|
-
</button>
|
|
74
|
-
</div>
|
|
75
|
-
</div>
|
|
76
|
-
</Scrollable_.Content>
|
|
77
|
-
</Scrollable_.Container>
|
|
78
|
-
|
|
79
|
-
<!-- New unified vertical scrollbar -->
|
|
80
|
-
<Scrollable_.Track
|
|
81
|
-
orientation="vertical"
|
|
82
|
-
class="inset-y-0 right-0 w-[2px] rounded-md"
|
|
83
|
-
initial={(node) => {
|
|
84
|
-
animate(node, { opacity: 0, right: 0, top: 0, bottom: 0 }, { duration: 0 });
|
|
85
|
-
}}
|
|
86
|
-
enter={(node) => {
|
|
87
|
-
animate(
|
|
88
|
-
node,
|
|
89
|
-
{ opacity: 1, right: 8, top: 8, bottom: 8 },
|
|
90
|
-
{ duration: 0.3, ease: 'easeOut' }
|
|
91
|
-
);
|
|
92
|
-
return {
|
|
93
|
-
duration: 300
|
|
94
|
-
};
|
|
95
|
-
}}
|
|
96
|
-
exit={(node) => {
|
|
97
|
-
animate(
|
|
98
|
-
node,
|
|
99
|
-
{ opacity: 0, right: 0, top: 0, bottom: 0 },
|
|
100
|
-
{ duration: 0.3, ease: 'easeOut' }
|
|
101
|
-
);
|
|
102
|
-
return {
|
|
103
|
-
duration: 300
|
|
104
|
-
};
|
|
105
|
-
}}
|
|
106
|
-
>
|
|
107
|
-
<Scrollable_.Thumb
|
|
108
|
-
orientation="vertical"
|
|
109
|
-
class="left-[50%] w-2 origin-center translate-x-[-50%] rounded-none transition-colors"
|
|
110
|
-
/>
|
|
111
|
-
</Scrollable_.Track>
|
|
112
|
-
{/snippet}
|
|
113
|
-
</Scrollable_.Root>
|
|
114
|
-
</div>
|
|
115
|
-
{/snippet}
|
|
116
|
-
</Story>
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import { Scrollable as Scrollable_ } from '.';
|
|
4
|
+
import { animate } from 'motion';
|
|
5
|
+
import { ScrollableBond } from './bond.svelte';
|
|
6
|
+
import { on } from '../../attachments/event.svelte';
|
|
7
|
+
|
|
8
|
+
const { Story } = defineMeta({
|
|
9
|
+
title: 'ATOMS/Scrollable'
|
|
10
|
+
});
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<Story name="Scrollable">
|
|
14
|
+
{#snippet children({ args })}
|
|
15
|
+
<div class="h-full w-full flex-1">
|
|
16
|
+
<Scrollable_.Root
|
|
17
|
+
class="border-border box-border flex min-h-full w-full rounded-lg border shadow-inner"
|
|
18
|
+
open={false}
|
|
19
|
+
{@attach (node) => {
|
|
20
|
+
const scrollable = ScrollableBond.get();
|
|
21
|
+
if (!scrollable) return;
|
|
22
|
+
|
|
23
|
+
const c1 = on('pointerenter', () => {
|
|
24
|
+
scrollable.state.props.open = true;
|
|
25
|
+
})(node);
|
|
26
|
+
|
|
27
|
+
const c2 = on('pointerleave', () => {
|
|
28
|
+
scrollable.state.props.open = false;
|
|
29
|
+
})(node);
|
|
30
|
+
|
|
31
|
+
return () => {
|
|
32
|
+
c1();
|
|
33
|
+
c2();
|
|
34
|
+
};
|
|
35
|
+
}}
|
|
36
|
+
>
|
|
37
|
+
{#snippet children({ scrollable })}
|
|
38
|
+
<Scrollable_.Container class="max-h-[100svh]">
|
|
39
|
+
<Scrollable_.Content>
|
|
40
|
+
<div class="mx-auto w-[600px] p-4">
|
|
41
|
+
<h3 class="mb-4 text-lg font-semibold">Scrollable Content (New API)</h3>
|
|
42
|
+
<div class="grid grid-cols-3 gap-4">
|
|
43
|
+
{#each Array(99) as _, i}
|
|
44
|
+
<div class="rounded border p-4 shadow">
|
|
45
|
+
<h4 class="font-medium">Card {i + 1}</h4>
|
|
46
|
+
<p class="mt-2 text-sm">
|
|
47
|
+
This is some sample content in card {i + 1}. You can scroll horizontally and
|
|
48
|
+
vertically to see more content.
|
|
49
|
+
</p>
|
|
50
|
+
</div>
|
|
51
|
+
{/each}
|
|
52
|
+
</div>
|
|
53
|
+
|
|
54
|
+
<div class="bg-foreground/10 mt-6 rounded p-4">
|
|
55
|
+
<p class="text-sm">
|
|
56
|
+
This content area is larger than the container, so you can scroll both
|
|
57
|
+
horizontally and vertically using the custom scrollbars or mouse wheel.
|
|
58
|
+
</p>
|
|
59
|
+
</div>
|
|
60
|
+
|
|
61
|
+
<div class="mt-4 flex gap-2">
|
|
62
|
+
<button
|
|
63
|
+
class="rounded bg-blue-500 px-3 py-2 hover:bg-blue-600"
|
|
64
|
+
onclick={() => scrollable.scrollTo(0, 0)}
|
|
65
|
+
>
|
|
66
|
+
Scroll to Top
|
|
67
|
+
</button>
|
|
68
|
+
<button
|
|
69
|
+
class="rounded bg-green-500 px-3 py-2 hover:bg-green-600"
|
|
70
|
+
onclick={() => scrollable.scrollBy(50, 50)}
|
|
71
|
+
>
|
|
72
|
+
Scroll +50px
|
|
73
|
+
</button>
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
</Scrollable_.Content>
|
|
77
|
+
</Scrollable_.Container>
|
|
78
|
+
|
|
79
|
+
<!-- New unified vertical scrollbar -->
|
|
80
|
+
<Scrollable_.Track
|
|
81
|
+
orientation="vertical"
|
|
82
|
+
class="inset-y-0 right-0 w-[2px] rounded-md"
|
|
83
|
+
initial={(node) => {
|
|
84
|
+
animate(node, { opacity: 0, right: 0, top: 0, bottom: 0 }, { duration: 0 });
|
|
85
|
+
}}
|
|
86
|
+
enter={(node) => {
|
|
87
|
+
animate(
|
|
88
|
+
node,
|
|
89
|
+
{ opacity: 1, right: 8, top: 8, bottom: 8 },
|
|
90
|
+
{ duration: 0.3, ease: 'easeOut' }
|
|
91
|
+
);
|
|
92
|
+
return {
|
|
93
|
+
duration: 300
|
|
94
|
+
};
|
|
95
|
+
}}
|
|
96
|
+
exit={(node) => {
|
|
97
|
+
animate(
|
|
98
|
+
node,
|
|
99
|
+
{ opacity: 0, right: 0, top: 0, bottom: 0 },
|
|
100
|
+
{ duration: 0.3, ease: 'easeOut' }
|
|
101
|
+
);
|
|
102
|
+
return {
|
|
103
|
+
duration: 300
|
|
104
|
+
};
|
|
105
|
+
}}
|
|
106
|
+
>
|
|
107
|
+
<Scrollable_.Thumb
|
|
108
|
+
orientation="vertical"
|
|
109
|
+
class="left-[50%] w-2 origin-center translate-x-[-50%] rounded-none transition-colors"
|
|
110
|
+
/>
|
|
111
|
+
</Scrollable_.Track>
|
|
112
|
+
{/snippet}
|
|
113
|
+
</Scrollable_.Root>
|
|
114
|
+
</div>
|
|
115
|
+
{/snippet}
|
|
116
|
+
</Story>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type Easing } from 'motion';
|
|
2
|
+
type AnimateSidebarContentParams = {
|
|
3
|
+
duration?: number;
|
|
4
|
+
delay?: number;
|
|
5
|
+
ease?: Easing | Easing[];
|
|
6
|
+
axis?: 'x' | 'y';
|
|
7
|
+
0?: number | string;
|
|
8
|
+
1?: number | string;
|
|
9
|
+
};
|
|
10
|
+
export declare function animateSidebarContent(params: AnimateSidebarContentParams): (node: HTMLElement) => void;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { animate } from 'motion';
|
|
2
|
+
import { DURATION } from '../../shared';
|
|
3
|
+
import { SidebarBond } from '.';
|
|
4
|
+
export function animateSidebarContent(params) {
|
|
5
|
+
const { duration = DURATION.fast / 1000, delay = 0, ease = 'easeInOut', axis = 'x', '0': collapsedSize = '96px', '1': expandedSize = 'auto' } = params;
|
|
6
|
+
const bond = SidebarBond.get();
|
|
7
|
+
const isOpen = bond?.state.props.open ?? false;
|
|
8
|
+
const collapsedProp = axis === 'x' ? 'min-width' : 'min-height';
|
|
9
|
+
const prop = axis === 'x' ? 'width' : 'height';
|
|
10
|
+
return (node) => {
|
|
11
|
+
animate(node, {
|
|
12
|
+
[prop]: isOpen ? expandedSize : collapsedSize,
|
|
13
|
+
[collapsedProp]: collapsedSize
|
|
14
|
+
}, { duration, ease, delay });
|
|
15
|
+
};
|
|
16
|
+
}
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
<script lang="ts" generics="E extends keyof HTMLElementTagNameMap = 'div', B extends Base = Base">
|
|
2
2
|
import { HtmlAtom, type Base } from '../atom';
|
|
3
3
|
import { SidebarBond } from './bond.svelte';
|
|
4
|
+
import { animateSidebarContent } from './motion.svelte';
|
|
4
5
|
import type { SidebarRootProps } from './types';
|
|
5
|
-
import { animate as motion } from 'motion';
|
|
6
6
|
|
|
7
7
|
const bond = SidebarBond.get();
|
|
8
8
|
|
|
9
9
|
let {
|
|
10
10
|
class: klass = '',
|
|
11
|
-
width = 'auto',
|
|
12
11
|
children = undefined,
|
|
13
12
|
onmount = undefined,
|
|
14
13
|
ondestroy = undefined,
|
|
15
|
-
animate =
|
|
14
|
+
animate = animateSidebarContent({ '0': '0px', '1': 'auto' }),
|
|
16
15
|
enter = undefined,
|
|
17
16
|
exit = undefined,
|
|
18
|
-
initial =
|
|
17
|
+
initial = animateSidebarContent({ '0': '0px', '1': 'auto', duration: 0 }),
|
|
19
18
|
...restProps
|
|
20
19
|
}: SidebarRootProps<E, B> = $props();
|
|
21
20
|
|
|
@@ -23,15 +22,6 @@
|
|
|
23
22
|
...bond?.content(),
|
|
24
23
|
...restProps
|
|
25
24
|
});
|
|
26
|
-
|
|
27
|
-
const isOpen = $derived(bond?.state.props.open);
|
|
28
|
-
|
|
29
|
-
function _initial(node: HTMLElement) {
|
|
30
|
-
motion(node, { width: isOpen ? width : 0 }, { duration: 0 });
|
|
31
|
-
}
|
|
32
|
-
function _animate(node: HTMLElement) {
|
|
33
|
-
motion(node, { width: isOpen ? width : 0 }, { duration: 0.3, ease: 'anticipate' });
|
|
34
|
-
}
|
|
35
25
|
</script>
|
|
36
26
|
|
|
37
27
|
<HtmlAtom
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
<script lang="ts" generics="E extends keyof HTMLElementTagNameMap = 'div', B extends Base = Base">
|
|
2
|
-
import { defineProperty, defineState } from '../../utils';
|
|
3
|
-
import { type Base } from '../atom';
|
|
4
|
-
import { SidebarBond, SidebarBondState, type SidebarBondProps } from './bond.svelte';
|
|
5
|
-
import type { SidebarRootProps } from './types';
|
|
6
|
-
|
|
7
|
-
let {
|
|
8
|
-
open = $bindable(false),
|
|
9
|
-
disabled = false,
|
|
10
|
-
factory = _factory,
|
|
11
|
-
children = undefined
|
|
12
|
-
}: SidebarRootProps<E, B> = $props();
|
|
13
|
-
|
|
14
|
-
const bondProps = defineState<SidebarBondProps>([
|
|
15
|
-
defineProperty(
|
|
16
|
-
'open',
|
|
17
|
-
() => open,
|
|
18
|
-
(v) => {
|
|
19
|
-
open = v;
|
|
20
|
-
}
|
|
21
|
-
),
|
|
22
|
-
defineProperty('disabled', () => disabled)
|
|
23
|
-
]);
|
|
24
|
-
|
|
25
|
-
const bond = factory(bondProps).share();
|
|
26
|
-
|
|
27
|
-
function _factory(props: typeof bondProps) {
|
|
28
|
-
const bondState = new SidebarBondState(() => props);
|
|
29
|
-
const bond = new SidebarBond(bondState);
|
|
30
|
-
|
|
31
|
-
return bond;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export function getBond() {
|
|
35
|
-
return bond;
|
|
36
|
-
}
|
|
37
|
-
</script>
|
|
38
|
-
|
|
39
|
-
{@render children?.({ sidebar: bond })}
|
|
1
|
+
<script lang="ts" generics="E extends keyof HTMLElementTagNameMap = 'div', B extends Base = Base">
|
|
2
|
+
import { defineProperty, defineState } from '../../utils';
|
|
3
|
+
import { type Base } from '../atom';
|
|
4
|
+
import { SidebarBond, SidebarBondState, type SidebarBondProps } from './bond.svelte';
|
|
5
|
+
import type { SidebarRootProps } from './types';
|
|
6
|
+
|
|
7
|
+
let {
|
|
8
|
+
open = $bindable(false),
|
|
9
|
+
disabled = false,
|
|
10
|
+
factory = _factory,
|
|
11
|
+
children = undefined
|
|
12
|
+
}: SidebarRootProps<E, B> = $props();
|
|
13
|
+
|
|
14
|
+
const bondProps = defineState<SidebarBondProps>([
|
|
15
|
+
defineProperty(
|
|
16
|
+
'open',
|
|
17
|
+
() => open,
|
|
18
|
+
(v) => {
|
|
19
|
+
open = v;
|
|
20
|
+
}
|
|
21
|
+
),
|
|
22
|
+
defineProperty('disabled', () => disabled)
|
|
23
|
+
]);
|
|
24
|
+
|
|
25
|
+
const bond = factory(bondProps).share();
|
|
26
|
+
|
|
27
|
+
function _factory(props: typeof bondProps) {
|
|
28
|
+
const bondState = new SidebarBondState(() => props);
|
|
29
|
+
const bond = new SidebarBond(bondState);
|
|
30
|
+
|
|
31
|
+
return bond;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function getBond() {
|
|
35
|
+
return bond;
|
|
36
|
+
}
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
{@render children?.({ sidebar: bond })}
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
<script module>
|
|
2
|
-
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
-
import { Sidebar as Sidebar_ } from '.';
|
|
4
|
-
|
|
5
|
-
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
6
|
-
const { Story } = defineMeta({
|
|
7
|
-
title: 'Atoms/Sidebar',
|
|
8
|
-
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
9
|
-
|
|
10
|
-
parameters: {
|
|
11
|
-
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
|
|
12
|
-
layout: 'fullscreen'
|
|
13
|
-
},
|
|
14
|
-
args: {}
|
|
15
|
-
});
|
|
16
|
-
</script>
|
|
17
|
-
|
|
18
|
-
<script lang="ts">
|
|
19
|
-
let isOpen = $state(false);
|
|
20
|
-
</script>
|
|
21
|
-
|
|
22
|
-
<Story name="Sidebar" args={{}}>
|
|
23
|
-
<Sidebar_.Root class="" bind:open={isOpen}>
|
|
24
|
-
{#snippet children({ sidebar })}
|
|
25
|
-
<div class="flex size-full">
|
|
26
|
-
<Sidebar_.Content
|
|
27
|
-
class="flex min-w-32 flex-col border-r px-6 py-10 whitespace-nowrap"
|
|
28
|
-
width="300px"
|
|
29
|
-
>
|
|
30
|
-
<div>
|
|
31
|
-
<button
|
|
32
|
-
onclick={() => {
|
|
33
|
-
sidebar?.state.toggle?.();
|
|
34
|
-
}}>Open</button
|
|
35
|
-
>
|
|
36
|
-
</div>
|
|
37
|
-
</Sidebar_.Content>
|
|
38
|
-
|
|
39
|
-
<main class="bg-foreground/2 flex-1 p-8">Hello World!</main>
|
|
40
|
-
</div>
|
|
41
|
-
{/snippet}
|
|
42
|
-
</Sidebar_.Root>
|
|
43
|
-
</Story>
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import { Sidebar as Sidebar_ } from '.';
|
|
4
|
+
|
|
5
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
6
|
+
const { Story } = defineMeta({
|
|
7
|
+
title: 'Atoms/Sidebar',
|
|
8
|
+
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
9
|
+
|
|
10
|
+
parameters: {
|
|
11
|
+
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
|
|
12
|
+
layout: 'fullscreen'
|
|
13
|
+
},
|
|
14
|
+
args: {}
|
|
15
|
+
});
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<script lang="ts">
|
|
19
|
+
let isOpen = $state(false);
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<Story name="Sidebar" args={{}}>
|
|
23
|
+
<Sidebar_.Root class="" bind:open={isOpen}>
|
|
24
|
+
{#snippet children({ sidebar })}
|
|
25
|
+
<div class="flex size-full">
|
|
26
|
+
<Sidebar_.Content
|
|
27
|
+
class="flex min-w-32 flex-col border-r px-6 py-10 whitespace-nowrap"
|
|
28
|
+
width="300px"
|
|
29
|
+
>
|
|
30
|
+
<div>
|
|
31
|
+
<button
|
|
32
|
+
onclick={() => {
|
|
33
|
+
sidebar?.state.toggle?.();
|
|
34
|
+
}}>Open</button
|
|
35
|
+
>
|
|
36
|
+
</div>
|
|
37
|
+
</Sidebar_.Content>
|
|
38
|
+
|
|
39
|
+
<main class="bg-foreground/2 flex-1 p-8">Hello World!</main>
|
|
40
|
+
</div>
|
|
41
|
+
{/snippet}
|
|
42
|
+
</Sidebar_.Root>
|
|
43
|
+
</Story>
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { Snippet } from 'svelte';
|
|
2
|
-
import type { Override } from '../../types';
|
|
3
1
|
import type { Factory } from '../../types';
|
|
4
2
|
import type { SidebarBond } from './bond.svelte';
|
|
5
3
|
import type { Base, HtmlAtomProps } from '../atom';
|
|
@@ -13,19 +11,11 @@ export interface SidebarRootExtendProps {
|
|
|
13
11
|
*/
|
|
14
12
|
export interface SidebarContentExtendProps {
|
|
15
13
|
}
|
|
16
|
-
export interface SidebarRootProps<E extends keyof HTMLElementTagNameMap = 'div', B extends Base = Base> extends
|
|
17
|
-
children?: Snippet<[{
|
|
18
|
-
sidebar?: SidebarBond;
|
|
19
|
-
}]>;
|
|
20
|
-
}>, SidebarRootExtendProps {
|
|
14
|
+
export interface SidebarRootProps<E extends keyof HTMLElementTagNameMap = 'div', B extends Base = Base> extends HtmlAtomProps<E, B>, SidebarRootExtendProps {
|
|
21
15
|
open?: boolean;
|
|
22
16
|
disabled?: boolean;
|
|
23
17
|
width?: string | number;
|
|
24
18
|
factory?: Factory<SidebarBond>;
|
|
25
19
|
}
|
|
26
|
-
export interface SidebarContentProps<E extends keyof HTMLElementTagNameMap, B extends Base = Base> extends
|
|
27
|
-
children?: Snippet<[{
|
|
28
|
-
sidebar?: SidebarBond<any>;
|
|
29
|
-
}]>;
|
|
30
|
-
}>, SidebarContentExtendProps {
|
|
20
|
+
export interface SidebarContentProps<E extends keyof HTMLElementTagNameMap, B extends Base = Base> extends HtmlAtomProps<E, B>, SidebarContentExtendProps {
|
|
31
21
|
}
|
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
<script module>
|
|
2
|
-
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
-
import { Tabs as Tabs_, Tab } from '.';
|
|
4
|
-
import { Root as TabsRoot } from './atoms';
|
|
5
|
-
|
|
6
|
-
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
7
|
-
const { Story } = defineMeta({
|
|
8
|
-
title: 'Atoms/Tabs',
|
|
9
|
-
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
10
|
-
|
|
11
|
-
parameters: {
|
|
12
|
-
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
|
|
13
|
-
layout: 'fullscreen'
|
|
14
|
-
},
|
|
15
|
-
args: {}
|
|
16
|
-
});
|
|
17
|
-
</script>
|
|
18
|
-
|
|
19
|
-
<script lang="ts">
|
|
20
|
-
let value = $state('ar');
|
|
21
|
-
</script>
|
|
22
|
-
|
|
23
|
-
<Story name="Tabs" args={{}}>
|
|
24
|
-
<Tabs_.Root bind:value>
|
|
25
|
-
<Tabs_.Header class="border-b" />
|
|
26
|
-
<Tabs_.Body>
|
|
27
|
-
<Tab.Root value="en">
|
|
28
|
-
<Tab.Header>English</Tab.Header>
|
|
29
|
-
<Tab.Body class="">
|
|
30
|
-
<div>
|
|
31
|
-
Ligula ex tincidunt efficitur netus consequat aenean finibus. Dictum ex pretium torquent
|
|
32
|
-
vel scelerisque quisque class nisl penatibus blandit risus. Pretium praesent egestas
|
|
33
|
-
ante placerat lacus pede risus pulvinar facilisi.
|
|
34
|
-
</div>
|
|
35
|
-
</Tab.Body>
|
|
36
|
-
</Tab.Root>
|
|
37
|
-
|
|
38
|
-
<Tab.Root value="ar">
|
|
39
|
-
<Tab.Header>Arabic</Tab.Header>
|
|
40
|
-
<Tab.Body class="h-[1440px]">
|
|
41
|
-
<div>
|
|
42
|
-
Interdum turpis taciti mauris orci condimentum vitae malesuada ornare ridiculus ultrices
|
|
43
|
-
quisque feugiat pretium facilisis justo ligula pede volutpat nisi viverra adipiscing
|
|
44
|
-
donec torquent ac sapien aliquet parturient posuere leo litora vivamus luctus vestibulum
|
|
45
|
-
aptent faucibus platea libero dolor purus integer fusce nam senectus nibh nostra diam
|
|
46
|
-
tortor dictumst praesent tellus montes ad iaculis sociosqu mollis sodales consectetuer
|
|
47
|
-
hac accumsan dictum blandit conubia velit elit efficitur duis nascetur erat mattis
|
|
48
|
-
semper et aliquam magna lorem bibendum ante id cursus nulla eget ut pellentesque
|
|
49
|
-
himenaeos consectetur potenti si maximus ullamcorper etiam nec magnis ipsum mus porta
|
|
50
|
-
lobortis natoque rhoncus fringilla
|
|
51
|
-
</div>
|
|
52
|
-
</Tab.Body>
|
|
53
|
-
</Tab.Root>
|
|
54
|
-
</Tabs_.Body>
|
|
55
|
-
</Tabs_.Root>
|
|
56
|
-
</Story>
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import { Tabs as Tabs_, Tab } from '.';
|
|
4
|
+
import { Root as TabsRoot } from './atoms';
|
|
5
|
+
|
|
6
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
7
|
+
const { Story } = defineMeta({
|
|
8
|
+
title: 'Atoms/Tabs',
|
|
9
|
+
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
10
|
+
|
|
11
|
+
parameters: {
|
|
12
|
+
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
|
|
13
|
+
layout: 'fullscreen'
|
|
14
|
+
},
|
|
15
|
+
args: {}
|
|
16
|
+
});
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<script lang="ts">
|
|
20
|
+
let value = $state('ar');
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<Story name="Tabs" args={{}}>
|
|
24
|
+
<Tabs_.Root bind:value>
|
|
25
|
+
<Tabs_.Header class="border-b" />
|
|
26
|
+
<Tabs_.Body>
|
|
27
|
+
<Tab.Root value="en">
|
|
28
|
+
<Tab.Header>English</Tab.Header>
|
|
29
|
+
<Tab.Body class="">
|
|
30
|
+
<div>
|
|
31
|
+
Ligula ex tincidunt efficitur netus consequat aenean finibus. Dictum ex pretium torquent
|
|
32
|
+
vel scelerisque quisque class nisl penatibus blandit risus. Pretium praesent egestas
|
|
33
|
+
ante placerat lacus pede risus pulvinar facilisi.
|
|
34
|
+
</div>
|
|
35
|
+
</Tab.Body>
|
|
36
|
+
</Tab.Root>
|
|
37
|
+
|
|
38
|
+
<Tab.Root value="ar">
|
|
39
|
+
<Tab.Header>Arabic</Tab.Header>
|
|
40
|
+
<Tab.Body class="h-[1440px]">
|
|
41
|
+
<div>
|
|
42
|
+
Interdum turpis taciti mauris orci condimentum vitae malesuada ornare ridiculus ultrices
|
|
43
|
+
quisque feugiat pretium facilisis justo ligula pede volutpat nisi viverra adipiscing
|
|
44
|
+
donec torquent ac sapien aliquet parturient posuere leo litora vivamus luctus vestibulum
|
|
45
|
+
aptent faucibus platea libero dolor purus integer fusce nam senectus nibh nostra diam
|
|
46
|
+
tortor dictumst praesent tellus montes ad iaculis sociosqu mollis sodales consectetuer
|
|
47
|
+
hac accumsan dictum blandit conubia velit elit efficitur duis nascetur erat mattis
|
|
48
|
+
semper et aliquam magna lorem bibendum ante id cursus nulla eget ut pellentesque
|
|
49
|
+
himenaeos consectetur potenti si maximus ullamcorper etiam nec magnis ipsum mus porta
|
|
50
|
+
lobortis natoque rhoncus fringilla
|
|
51
|
+
</div>
|
|
52
|
+
</Tab.Body>
|
|
53
|
+
</Tab.Root>
|
|
54
|
+
</Tabs_.Body>
|
|
55
|
+
</Tabs_.Root>
|
|
56
|
+
</Story>
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
let { class: klass = '', value = $bindable(), ...restProps } = $props();
|
|
3
|
-
</script>
|
|
4
|
-
|
|
5
|
-
<textarea
|
|
6
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
let { class: klass = '', value = $bindable(), ...restProps } = $props();
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<textarea
|
|
6
|
+
class={['border-border w-full p-2 outline-none', '$preset', klass]}
|
|
7
|
+
bind:value
|
|
8
|
+
{...restProps}
|
|
9
|
+
></textarea>
|