@svelte-atoms/core 1.0.0-alpha.29 → 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 +3 -2
- package/dist/attachments/clickout.svelte.d.ts +1 -1
- package/dist/attachments/clickout.svelte.js +2 -2
- package/dist/components/accordion/accordion-root.svelte +65 -61
- package/dist/components/accordion/accordion-root.svelte.d.ts +1 -1
- package/dist/components/accordion/accordion.stories.svelte +70 -134
- 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 +10 -11
- 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 -207
- package/dist/components/avatar/avatar.stories.svelte +8 -13
- package/dist/components/badge/badge.stories.svelte +1 -6
- package/dist/components/badge/badge.svelte +1 -1
- package/dist/components/breadcrumb/breadcrumb.stories.svelte +16 -21
- package/dist/components/button/button.stories.svelte +1 -34
- package/dist/components/calendar/calendar-day.svelte +9 -4
- package/dist/components/calendar/calendar-header.svelte +29 -29
- package/dist/components/calendar/calendar-root.svelte +206 -206
- package/dist/components/calendar/calendar.stories.svelte +26 -31
- package/dist/components/card/card-body.svelte +1 -1
- package/dist/components/card/card-footer.svelte +1 -1
- package/dist/components/card/card-root.svelte +1 -1
- package/dist/components/card/card.stories.svelte +92 -104
- package/dist/components/checkbox/checkbox.stories.svelte +4 -9
- package/dist/components/checkbox/checkbox.svelte +159 -157
- package/dist/components/collapsible/collapsible.stories.svelte +2 -3
- package/dist/components/combobox/atoms.d.ts +1 -1
- package/dist/components/combobox/atoms.js +1 -1
- package/dist/components/combobox/combobox-root.svelte +1 -1
- package/dist/components/combobox/compobox.stories.svelte +19 -22
- package/dist/components/combobox/index.d.ts +1 -0
- package/dist/components/container/container.stories.svelte +8 -11
- package/dist/components/container/container.svelte.d.ts +1 -1
- package/dist/components/datagrid/datagrid-root.svelte +59 -59
- package/dist/components/datagrid/datagrid.css +5 -5
- package/dist/components/datagrid/datagrid.stories.svelte +47 -50
- 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 +2 -2
- package/dist/components/date-picker/date-picker-header.svelte +100 -100
- package/dist/components/date-picker/date-picker-months.svelte +142 -142
- package/dist/components/date-picker/date-picker-root.svelte +95 -95
- package/dist/components/date-picker/date-picker-years.svelte +205 -205
- package/dist/components/date-picker/date-picker.stories.svelte +35 -42
- 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 +2 -20
- package/dist/components/dialog/dialog-root.svelte +91 -110
- package/dist/components/dialog/dialog.stories.svelte +34 -37
- 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 +7 -10
- 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 +49 -42
- package/dist/components/drawer/drawer.stories.svelte +144 -224
- 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 +1 -1
- package/dist/components/dropdown/dropdown.stories.svelte +38 -41
- package/dist/components/dropdown/index.d.ts +1 -0
- package/dist/components/form/form.stories.svelte +58 -61
- package/dist/components/image/image.stories.svelte +9 -12
- package/dist/components/input/input.stories.svelte +11 -14
- package/dist/components/label/label.stories.svelte +1 -12
- package/dist/components/label/label.stories.svelte.d.ts +24 -4
- package/dist/components/lazy/lazy.stories.svelte +28 -35
- package/dist/components/lazy/lazy.svelte +28 -28
- package/dist/components/link/link.stories.svelte +1 -12
- package/dist/components/link/link.stories.svelte.d.ts +24 -4
- 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-list.svelte +40 -40
- package/dist/components/menu/menu.stories.svelte +9 -12
- package/dist/components/popover/bond.svelte.d.ts +20 -7
- package/dist/components/popover/bond.svelte.js +104 -45
- package/dist/components/popover/motion.d.ts +6 -0
- package/dist/components/popover/motion.js +56 -0
- package/dist/components/popover/popover-arrow.svelte +4 -4
- package/dist/components/popover/popover-content.svelte +137 -178
- package/dist/components/popover/popover-indicator.svelte +2 -1
- package/dist/components/popover/popover-root.svelte +1 -1
- package/dist/components/popover/popover.stories.svelte +49 -52
- 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 -27
- package/dist/components/qr-code/qr-code.svelte +75 -75
- package/dist/components/radio/radio-group.stories.svelte +21 -30
- package/dist/components/radio/radio.stories.svelte +1 -10
- package/dist/components/radio/radio.svelte +109 -109
- package/dist/components/radio/types.d.ts +98 -0
- package/dist/components/radio/types.js +2 -0
- package/dist/components/root/root.svelte +104 -121
- package/dist/components/scrollable/scrollable-root.svelte.d.ts +2 -2
- package/dist/components/scrollable/scrollable.stories.svelte +95 -105
- 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 -2
- package/dist/components/sidebar/sidebar-root.svelte +39 -41
- package/dist/components/sidebar/sidebar.stories.svelte +43 -54
- package/dist/components/sidebar/types.d.ts +3 -12
- package/dist/components/tabs/tab/bond.svelte.d.ts +4 -1
- package/dist/components/tabs/tab/bond.svelte.js +4 -1
- package/dist/components/tabs/tabs.stories.svelte +31 -34
- 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 +39 -37
- package/dist/components/tooltip/tooltip-trigger.svelte.d.ts +1 -0
- package/dist/components/tooltip/tooltip.stories.svelte +7 -10
- package/dist/components/tree/tree.stories.svelte +102 -94
- package/dist/context/preset.svelte.d.ts +3 -3
- 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/function.d.ts +2 -0
- package/dist/utils/function.js +6 -0
- package/dist/utils/markdown-to-llm.d.ts +28 -0
- package/dist/utils/markdown-to-llm.js +76 -0
- package/package.json +6 -10
- package/dist/actions/animation.svelte.d.ts +0 -6
- package/dist/actions/animation.svelte.js +0 -14
- package/dist/actions/clickout.svelte.d.ts +0 -2
- package/dist/actions/clickout.svelte.js +0 -15
- package/dist/actions/popover.svelte.d.ts +0 -19
- package/dist/actions/popover.svelte.js +0 -81
- package/dist/actions/portal.svelte.d.ts +0 -8
- package/dist/actions/portal.svelte.js +0 -32
- package/dist/attachments/gsap.svelte.d.ts +0 -2
- package/dist/attachments/gsap.svelte.js +0 -26
- 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
|
@@ -4,8 +4,10 @@ type TextareaRoot = {
|
|
|
4
4
|
$set?(props: Partial<$$ComponentProps>): void;
|
|
5
5
|
};
|
|
6
6
|
declare const TextareaRoot: import("svelte").Component<{
|
|
7
|
+
class?: string;
|
|
7
8
|
children: any;
|
|
8
9
|
} & Record<string, any>, {}, "">;
|
|
9
10
|
type $$ComponentProps = {
|
|
11
|
+
class?: string;
|
|
10
12
|
children: any;
|
|
11
13
|
} & Record<string, any>;
|
|
@@ -1,37 +1,39 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { PopoverBond } from '../popover/bond.svelte';
|
|
3
|
-
import { Trigger } from '../popover/atoms';
|
|
4
|
-
|
|
5
|
-
const popoverBond = PopoverBond.get();
|
|
6
|
-
|
|
7
|
-
let { onmount, children, ...restProps } = $props();
|
|
8
|
-
|
|
9
|
-
function tooltip(node: HTMLElement) {
|
|
10
|
-
const onpointerenter = async (
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { PopoverBond } from '../popover/bond.svelte';
|
|
3
|
+
import { Trigger } from '../popover/atoms';
|
|
4
|
+
|
|
5
|
+
const popoverBond = PopoverBond.get();
|
|
6
|
+
|
|
7
|
+
let { onmount, children, onclick = undefined, ...restProps } = $props();
|
|
8
|
+
|
|
9
|
+
function tooltip(node: HTMLElement) {
|
|
10
|
+
const onpointerenter = async () => {
|
|
11
|
+
requestAnimationFrame(() => {
|
|
12
|
+
popoverBond?.state.open();
|
|
13
|
+
});
|
|
14
|
+
node.addEventListener('pointerleave', onpointerleave);
|
|
15
|
+
};
|
|
16
|
+
const onpointerleave = () => {
|
|
17
|
+
popoverBond?.state.close();
|
|
18
|
+
node.removeEventListener('pointerleave', onpointerleave);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
node.addEventListener('pointerenter', onpointerenter, { passive: true });
|
|
22
|
+
|
|
23
|
+
const cleanup = () => {
|
|
24
|
+
node.removeEventListener('pointerenter', onpointerenter);
|
|
25
|
+
node.removeEventListener('pointerleave', onpointerleave);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const unmount = onmount?.(node);
|
|
29
|
+
|
|
30
|
+
return () => {
|
|
31
|
+
cleanup?.();
|
|
32
|
+
unmount?.();
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<Trigger preset="tooltip.trigger" onmount={tooltip} {onclick} {...restProps}>
|
|
38
|
+
{@render children?.()}
|
|
39
|
+
</Trigger>
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
3
|
import { Tooltip as Tooltip_ } from '.';
|
|
4
4
|
import { Root as TooltipRoot } from './atoms';
|
|
5
|
-
import Root from '../root/root.svelte';
|
|
6
5
|
import { Button } from '../button';
|
|
7
6
|
|
|
8
7
|
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
@@ -23,13 +22,11 @@
|
|
|
23
22
|
</script>
|
|
24
23
|
|
|
25
24
|
<Story name="Tooltip" args={{}}>
|
|
26
|
-
<Root
|
|
27
|
-
<Tooltip_.
|
|
28
|
-
|
|
29
|
-
<
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
</Tooltip_.Root>
|
|
34
|
-
</Root>
|
|
25
|
+
<Tooltip_.Root bind:open offset={0}>
|
|
26
|
+
<Tooltip_.Trigger base={Button}>Open Popover</Tooltip_.Trigger>
|
|
27
|
+
<Tooltip_.Content>
|
|
28
|
+
<div>Hello World !</div>
|
|
29
|
+
<Tooltip_.Arrow />
|
|
30
|
+
</Tooltip_.Content>
|
|
31
|
+
</Tooltip_.Root>
|
|
35
32
|
</Story>
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
<script module>
|
|
2
2
|
import { untrack } from 'svelte';
|
|
3
|
-
import
|
|
3
|
+
import { animate } from 'motion';
|
|
4
4
|
import { RenderScan } from 'svelte-render-scan';
|
|
5
5
|
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
6
6
|
import { dev } from '$app/environment';
|
|
7
7
|
import { Tree as Tree_ } from '.';
|
|
8
8
|
import { tree } from './attachments.svelte';
|
|
9
|
-
import { Root as TreeRoot } from './atoms';
|
|
10
9
|
import { TreeBond } from './bond.svelte';
|
|
11
|
-
import Root from '../root/root.svelte';
|
|
12
10
|
|
|
13
11
|
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
14
12
|
const { Story } = defineMeta({
|
|
@@ -28,107 +26,117 @@
|
|
|
28
26
|
</script>
|
|
29
27
|
|
|
30
28
|
<Story name="Tree" args={{}}>
|
|
31
|
-
<Root class="
|
|
32
|
-
|
|
33
|
-
{
|
|
34
|
-
|
|
35
|
-
{/if}
|
|
29
|
+
<Tree_.Root class="" bind:open>
|
|
30
|
+
{#if dev}
|
|
31
|
+
<RenderScan duration={300} />
|
|
32
|
+
{/if}
|
|
36
33
|
|
|
37
|
-
|
|
34
|
+
<Tree_.Header>Vehicles</Tree_.Header>
|
|
38
35
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
36
|
+
<Tree_.Body
|
|
37
|
+
class="border-l border-l-neutral-200"
|
|
38
|
+
onmount={(node) => {
|
|
39
|
+
const bond = TreeBond.get();
|
|
40
|
+
const isOpen = untrack(() => bond?.state.props.open ?? false);
|
|
41
|
+
animate(node, { height: +isOpen ? 'auto' : 0, opacity: +isOpen }, { duration: 0 });
|
|
42
|
+
}}
|
|
43
|
+
{@attach tree((node, bond) => {
|
|
44
|
+
const isOpen = bond?.state.props.open ?? false;
|
|
45
|
+
animate(
|
|
46
|
+
node,
|
|
47
|
+
{
|
|
49
48
|
height: +isOpen ? 'auto' : 0,
|
|
50
49
|
opacity: +isOpen,
|
|
51
|
-
pointerEvents: isOpen ? 'all' : 'none'
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
50
|
+
pointerEvents: isOpen ? 'all' : 'none'
|
|
51
|
+
},
|
|
52
|
+
{ duration: 0.1 }
|
|
53
|
+
);
|
|
54
|
+
})}
|
|
55
|
+
>
|
|
56
|
+
<Tree_.Root>
|
|
57
|
+
<Tree_.Header>Cars</Tree_.Header>
|
|
58
|
+
<Tree_.Body
|
|
59
|
+
class="border-l border-l-neutral-200"
|
|
60
|
+
onmount={(node) => {
|
|
61
|
+
const bond = TreeBond.get();
|
|
62
|
+
const isOpen = bond?.state.props.open ?? false;
|
|
63
|
+
animate(node, { height: +isOpen ? 'auto' : 0, opacity: +isOpen }, { duration: 0 });
|
|
64
|
+
}}
|
|
65
|
+
animate={(node) => {
|
|
66
|
+
const bond = TreeBond.get();
|
|
67
|
+
const isOpen = bond?.state.props.open ?? false;
|
|
68
|
+
animate(
|
|
69
|
+
node,
|
|
70
|
+
{
|
|
69
71
|
height: +isOpen ? 'auto' : 0,
|
|
70
72
|
opacity: +isOpen,
|
|
71
|
-
pointerEvents: isOpen ? 'all' : 'none'
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
</Tree_.
|
|
73
|
+
pointerEvents: isOpen ? 'all' : 'none'
|
|
74
|
+
},
|
|
75
|
+
{ duration: 0.1 }
|
|
76
|
+
);
|
|
77
|
+
}}
|
|
78
|
+
>
|
|
79
|
+
Mauris et habitasse cubilia potenti at condimentum iaculis nam. Ante fusce litora
|
|
80
|
+
tristique letius libero. Curabitur vitae cursus consectetur feugiat aenean viverra vel
|
|
81
|
+
dolor diam nascetur.
|
|
82
|
+
</Tree_.Body>
|
|
83
|
+
</Tree_.Root>
|
|
81
84
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
85
|
+
<Tree_.Root>
|
|
86
|
+
<Tree_.Header>Trucks</Tree_.Header>
|
|
87
|
+
<Tree_.Body
|
|
88
|
+
class="border-l border-l-neutral-200"
|
|
89
|
+
onmount={(node) => {
|
|
90
|
+
const bond = TreeBond.get();
|
|
91
|
+
const isOpen = bond?.state.props.open ?? false;
|
|
92
|
+
animate(node, { height: +isOpen ? 'auto' : 0, opacity: +isOpen }, { duration: 0 });
|
|
93
|
+
}}
|
|
94
|
+
{@attach tree((node, bond) => {
|
|
95
|
+
const isOpen = bond?.state.props.open ?? false;
|
|
96
|
+
animate(
|
|
97
|
+
node,
|
|
98
|
+
{
|
|
94
99
|
height: +isOpen ? 'auto' : 0,
|
|
95
100
|
opacity: +isOpen,
|
|
96
|
-
pointerEvents: isOpen ? 'all' : 'none'
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
</Tree_.
|
|
101
|
+
pointerEvents: isOpen ? 'all' : 'none'
|
|
102
|
+
},
|
|
103
|
+
{ duration: 0.1 }
|
|
104
|
+
);
|
|
105
|
+
})}
|
|
106
|
+
>
|
|
107
|
+
Mauris et habitasse cubilia potenti at condimentum iaculis nam. Ante fusce litora
|
|
108
|
+
tristique letius libero. Curabitur vitae cursus consectetur feugiat aenean viverra vel
|
|
109
|
+
dolor diam nascetur.
|
|
110
|
+
</Tree_.Body>
|
|
111
|
+
</Tree_.Root>
|
|
106
112
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
113
|
+
<Tree_.Root>
|
|
114
|
+
<Tree_.Header>Bikes</Tree_.Header>
|
|
115
|
+
<Tree_.Body
|
|
116
|
+
class="border-l border-l-neutral-200"
|
|
117
|
+
onmount={(node) => {
|
|
118
|
+
const bond = TreeBond.get();
|
|
119
|
+
const isOpen = untrack(() => bond?.state.props.open ?? false);
|
|
120
|
+
animate(node, { height: +isOpen ? 'auto' : 0, opacity: +isOpen }, { duration: 0 });
|
|
121
|
+
}}
|
|
122
|
+
{@attach tree((node, bond) => {
|
|
123
|
+
const isOpen = bond?.state.props.open ?? false;
|
|
124
|
+
animate(
|
|
125
|
+
node,
|
|
126
|
+
{
|
|
119
127
|
height: +isOpen ? 'auto' : 0,
|
|
120
128
|
opacity: +isOpen,
|
|
121
|
-
pointerEvents: isOpen ? 'all' : 'none'
|
|
122
|
-
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
</Tree_.
|
|
131
|
-
</Tree_.
|
|
132
|
-
</Tree_.
|
|
133
|
-
</Root>
|
|
129
|
+
pointerEvents: isOpen ? 'all' : 'none'
|
|
130
|
+
},
|
|
131
|
+
{ duration: 0.1 }
|
|
132
|
+
);
|
|
133
|
+
})}
|
|
134
|
+
>
|
|
135
|
+
Mauris et habitasse cubilia potenti at condimentum iaculis nam. Ante fusce litora
|
|
136
|
+
tristique letius libero. Curabitur vitae cursus consectetur feugiat aenean viverra vel
|
|
137
|
+
dolor diam nascetur.
|
|
138
|
+
</Tree_.Body>
|
|
139
|
+
</Tree_.Root>
|
|
140
|
+
</Tree_.Body>
|
|
141
|
+
</Tree_.Root>
|
|
134
142
|
</Story>
|
|
@@ -2,7 +2,7 @@ import type { ClassValue } from 'svelte/elements';
|
|
|
2
2
|
import type { Base } from '../components/atom';
|
|
3
3
|
import type { Bond } from '../shared';
|
|
4
4
|
export type PresetModuleName = 'accordion' | 'accordion.item.body' | 'accordion.item.header' | 'accordion.item.indicator' | 'accordion.item' | 'alert.actions' | 'alert.close-button' | 'alert.content' | 'alert.description' | 'alert.icon' | 'alert' | 'alert.title' | 'card.content' | 'card.description' | 'card.footer' | 'card.header' | 'card.media' | 'card' | 'card.subtitle' | 'card.title' | 'collapsible.body' | 'collapsible.header' | 'collapsible.indicator' | 'collapsible' | 'combobox.control' | 'combobox.trigger' | 'combobox.item' | 'dialog.close-button' | 'dialog.body' | 'dialog.content' | 'dialog.description' | 'dialog.footer' | 'dialog.header' | 'dialog' | 'dialog.title' | 'divider' | 'dropdown.placeholder' | 'dropdown.query' | 'dropdown.trigger' | 'dropdown.value' | 'dropdown' | 'field.control' | 'field.label' | 'field' | 'form' | 'icon' | 'input' | 'input.control' | 'input.placeholder' | 'label' | 'layer.inner' | 'layer' | 'link' | 'list.divider' | 'list.group' | 'list.item' | 'list.item' | 'list.item' | 'dropdown.item' | 'menu.body' | 'popover.arrow' | 'popover.indicator' | 'popover.content' | 'popover.trigger' | 'portal.inner' | 'portal' | 'root' | 'root.portals' | 'sidebar.content' | 'sidebar' | 'drawer.backdrop' | 'drawer.body' | 'drawer.content' | 'drawer.description' | 'drawer.title' | 'drawer.footer' | 'drawer.header' | 'drawer' | 'stack.root' | 'stack.item' | 'tabs.body' | 'tabs.header' | 'tabs' | 'tab.header' | 'tab.body' | 'tab.description' | 'tab' | 'tree.body' | 'tree.header' | 'tree.indicator' | 'tree' | 'datagrid' | 'datagrid.header' | 'datagrid.th' | 'datagrid.body' | 'datagrid.tr' | 'datagrid.td' | 'datagrid.footer' | 'datagrid.checkbox' | 'datagrid.sort-icon' | 'scrollable' | 'scrollable.container' | 'scrollable.content' | 'scrollable.track' | 'scrollable.thumb' | 'breadcrumb' | 'breadcrumb.item' | 'breadcrumb.separator' | 'badge' | 'button' | 'checkbox' | 'checkbox.checkmark' | 'checkbox.indeterminate' | 'radio' | 'radio.group' | 'container' | 'calendar' | 'calendar.day' | 'calendar.header' | 'calendar.weekday' | 'calendar.body' | 'datepicker.trigger' | 'datepicker.calendar' | 'datepicker.years' | 'datepicker.months' | 'datepicker.header';
|
|
5
|
-
export
|
|
5
|
+
export interface PresetEntryRecord {
|
|
6
6
|
[key: string]: unknown;
|
|
7
7
|
class?: ClassValue;
|
|
8
8
|
as?: string;
|
|
@@ -10,8 +10,8 @@ export type PresetEntryRecord = {
|
|
|
10
10
|
variants?: Record<string, Record<string, any>>;
|
|
11
11
|
compounds?: Array<Record<string, any>>;
|
|
12
12
|
defaults?: Record<string, any>;
|
|
13
|
-
}
|
|
14
|
-
export type PresetEntry = (
|
|
13
|
+
}
|
|
14
|
+
export type PresetEntry = (bond: Bond | undefined | null, ...args: any[]) => PresetEntryRecord | (() => PresetEntryRecord);
|
|
15
15
|
export type Preset = Record<PresetModuleName, PresetEntry>;
|
|
16
16
|
export declare function getPreset<K extends PresetModuleName>(key: K): PresetEntry | undefined;
|
|
17
17
|
export declare function getPreset(): Partial<Preset> | undefined;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="size-full" viewBox="0 0 24 24"
|
|
2
|
+
><!-- Icon from Fluent UI System Icons by Microsoft Corporation - https://github.com/microsoft/fluentui-system-icons/blob/main/LICENSE --><path
|
|
3
|
+
fill="currentColor"
|
|
4
|
+
d="M5.503 4.627 5.5 6.75v10.504a3.25 3.25 0 0 0 3.25 3.25h8.616a2.251 2.251 0 0 1-2.122 1.5H8.75A4.75 4.75 0 0 1 4 17.254V6.75c0-.98.627-1.815 1.503-2.123M17.75 2A2.25 2.25 0 0 1 20 4.25v13a2.25 2.25 0 0 1-2.25 2.25h-9a2.25 2.25 0 0 1-2.25-2.25v-13A2.25 2.25 0 0 1 8.75 2zM7.75 17.25c0 .414.336.75.75.75h9a.75.75 0 0 0 .75-.75v-13a.75.75 0 0 0-.75-.75h-9a.75.75 0 0 0-.75.75z"
|
|
5
|
+
/></svg
|
|
6
|
+
>
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export default
|
|
2
|
-
type
|
|
1
|
+
export default IconCopy;
|
|
2
|
+
type IconCopy = SvelteComponent<{
|
|
3
3
|
[x: string]: never;
|
|
4
4
|
}, {
|
|
5
5
|
[evt: string]: CustomEvent<any>;
|
|
6
6
|
}, {}> & {
|
|
7
7
|
$$bindings?: string;
|
|
8
8
|
};
|
|
9
|
-
declare const
|
|
9
|
+
declare const IconCopy: $$__sveltets_2_IsomorphicComponent<{
|
|
10
10
|
[x: string]: never;
|
|
11
11
|
}, {
|
|
12
12
|
[evt: string]: CustomEvent<any>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface PropDefinition {
|
|
2
|
+
name: string;
|
|
3
|
+
type: string;
|
|
4
|
+
default: string;
|
|
5
|
+
description: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Converts prop definitions to markdown table format
|
|
9
|
+
*/
|
|
10
|
+
export declare function propsToMarkdown(props: PropDefinition[]): string;
|
|
11
|
+
/**
|
|
12
|
+
* Injects props into markdown content by replacing placeholders
|
|
13
|
+
* Placeholders format: {{propName}}
|
|
14
|
+
*/
|
|
15
|
+
export declare function injectPropsIntoMarkdown(markdown: string, propsMap: Record<string, PropDefinition[]>): string;
|
|
16
|
+
/**
|
|
17
|
+
* Converts markdown content to LLM-friendly text format
|
|
18
|
+
* Keeps markdown syntax as-is since LLMs parse it well
|
|
19
|
+
*/
|
|
20
|
+
export declare function markdownToLLM(markdown: string): string;
|
|
21
|
+
/**
|
|
22
|
+
* Reads markdown files from the docs directory
|
|
23
|
+
*/
|
|
24
|
+
export declare function readMarkdownFile(filePath: string): Promise<string>;
|
|
25
|
+
/**
|
|
26
|
+
* Generate LLM-friendly documentation metadata
|
|
27
|
+
*/
|
|
28
|
+
export declare function generateLLMHeader(title: string, description: string, version?: string): string;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts prop definitions to markdown table format
|
|
3
|
+
*/
|
|
4
|
+
export function propsToMarkdown(props) {
|
|
5
|
+
if (!props || props.length === 0)
|
|
6
|
+
return '';
|
|
7
|
+
let markdown = '| Name | Type | Default | Description |\n';
|
|
8
|
+
markdown += '|------|------|---------|-------------|\n';
|
|
9
|
+
for (const prop of props) {
|
|
10
|
+
const name = prop.name.replace(/\|/g, '\\|');
|
|
11
|
+
const type = prop.type.replace(/\|/g, '\\|');
|
|
12
|
+
const defaultVal = prop.default.replace(/\|/g, '\\|');
|
|
13
|
+
const description = prop.description.replace(/\|/g, '\\|');
|
|
14
|
+
markdown += `| ${name} | ${type} | ${defaultVal} | ${description} |\n`;
|
|
15
|
+
}
|
|
16
|
+
return markdown;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Injects props into markdown content by replacing placeholders
|
|
20
|
+
* Placeholders format: {{propName}}
|
|
21
|
+
*/
|
|
22
|
+
export function injectPropsIntoMarkdown(markdown, propsMap) {
|
|
23
|
+
let result = markdown;
|
|
24
|
+
for (const [key, props] of Object.entries(propsMap)) {
|
|
25
|
+
const placeholder = new RegExp(`{{${key}}}`, 'g');
|
|
26
|
+
const propsMarkdown = propsToMarkdown(props);
|
|
27
|
+
result = result.replace(placeholder, propsMarkdown);
|
|
28
|
+
}
|
|
29
|
+
return result;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Converts markdown content to LLM-friendly text format
|
|
33
|
+
* Keeps markdown syntax as-is since LLMs parse it well
|
|
34
|
+
*/
|
|
35
|
+
export function markdownToLLM(markdown) {
|
|
36
|
+
let text = markdown;
|
|
37
|
+
// Remove HTML comments
|
|
38
|
+
text = text.replace(/<!--[\s\S]*?-->/g, '');
|
|
39
|
+
// Remove excessive blank lines (more than 2)
|
|
40
|
+
text = text.replace(/\n{3,}/g, '\n\n');
|
|
41
|
+
// Trim whitespace
|
|
42
|
+
text = text.trim();
|
|
43
|
+
return text;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Reads markdown files from the docs directory
|
|
47
|
+
*/
|
|
48
|
+
export async function readMarkdownFile(filePath) {
|
|
49
|
+
try {
|
|
50
|
+
// In production, you might want to use a different approach
|
|
51
|
+
// This is a placeholder - adjust based on your build setup
|
|
52
|
+
const response = await fetch(filePath);
|
|
53
|
+
if (!response.ok)
|
|
54
|
+
throw new Error(`Failed to fetch ${filePath}`);
|
|
55
|
+
return await response.text();
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
console.error(`Error reading markdown file: ${filePath}`, error);
|
|
59
|
+
return '';
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Generate LLM-friendly documentation metadata
|
|
64
|
+
*/
|
|
65
|
+
export function generateLLMHeader(title, description, version = '1.0.0-alpha.30') {
|
|
66
|
+
return `# ${title}
|
|
67
|
+
|
|
68
|
+
${description}
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
Generated: ${new Date().toISOString()}
|
|
72
|
+
Version: ${version}
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
`;
|
|
76
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@svelte-atoms/core",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.31",
|
|
4
4
|
"description": "A modular, accessible, and extensible Svelte UI component library.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -31,7 +31,6 @@
|
|
|
31
31
|
},
|
|
32
32
|
"files": [
|
|
33
33
|
"dist",
|
|
34
|
-
"llm",
|
|
35
34
|
"!dist/**/*.test.*",
|
|
36
35
|
"!dist/**/*.spec.*"
|
|
37
36
|
],
|
|
@@ -357,11 +356,6 @@
|
|
|
357
356
|
"svelte": "./dist/components/tooltip/atoms.js",
|
|
358
357
|
"default": "./dist/components/tooltip/atoms.js"
|
|
359
358
|
},
|
|
360
|
-
"./components": {
|
|
361
|
-
"types": "./dist/components/index.d.ts",
|
|
362
|
-
"svelte": "./dist/components/index.js",
|
|
363
|
-
"default": "./dist/components/index.js"
|
|
364
|
-
},
|
|
365
359
|
"./utils": {
|
|
366
360
|
"types": "./dist/utils/index.d.ts",
|
|
367
361
|
"svelte": "./dist/utils/index.js",
|
|
@@ -372,6 +366,10 @@
|
|
|
372
366
|
"svelte": "./dist/shared/index.js",
|
|
373
367
|
"default": "./dist/shared/index.js"
|
|
374
368
|
},
|
|
369
|
+
"./tw": {
|
|
370
|
+
"svelte": "./dist/components/root/root.css",
|
|
371
|
+
"default": "./dist/components/root/root.css"
|
|
372
|
+
},
|
|
375
373
|
"./styles/root": {
|
|
376
374
|
"svelte": "./dist/components/root/root.css",
|
|
377
375
|
"default": "./dist/components/root/root.css"
|
|
@@ -456,10 +454,8 @@
|
|
|
456
454
|
"clsx": "^2.1.1",
|
|
457
455
|
"date-fns": "^4.1.0",
|
|
458
456
|
"es-toolkit": "^1.37.2",
|
|
459
|
-
"gsap": "^3.13.0",
|
|
460
457
|
"motion": "^12.23.22",
|
|
461
458
|
"nanoid": "^5.1.5",
|
|
462
|
-
"tailwind-merge": "^3.2.0"
|
|
463
|
-
"uqr": "^0.1.2"
|
|
459
|
+
"tailwind-merge": "^3.2.0"
|
|
464
460
|
}
|
|
465
461
|
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export declare function animate(node: HTMLElement | SVGElement, fn: () => gsap.TweenVars): void;
|
|
2
|
-
export type GsapFromToParams = {
|
|
3
|
-
from: gsap.TweenVars;
|
|
4
|
-
to: gsap.TweenVars;
|
|
5
|
-
};
|
|
6
|
-
export declare function gsapFromTo(node: HTMLElement | SVGElement, fn: () => GsapFromToParams): void;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { gsap } from 'gsap';
|
|
2
|
-
export function animate(node, fn) {
|
|
3
|
-
gsap.set(node, fn());
|
|
4
|
-
$effect(() => {
|
|
5
|
-
gsap.to(node, fn());
|
|
6
|
-
});
|
|
7
|
-
}
|
|
8
|
-
export function gsapFromTo(node, fn) {
|
|
9
|
-
gsap.set(node, { ...fn().from });
|
|
10
|
-
$effect(() => {
|
|
11
|
-
const { from, to } = fn();
|
|
12
|
-
gsap.fromTo(node, { ...from }, { ...to });
|
|
13
|
-
});
|
|
14
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export function clickout(node, onclick) {
|
|
2
|
-
const handler = (ev) => {
|
|
3
|
-
const target = ev.target;
|
|
4
|
-
if (!node.contains(target)) {
|
|
5
|
-
onclick?.(ev);
|
|
6
|
-
}
|
|
7
|
-
};
|
|
8
|
-
document.addEventListener('click', handler);
|
|
9
|
-
return () => {
|
|
10
|
-
document.removeEventListener('click', handler);
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
export function clickoutAction(node, onclick) {
|
|
14
|
-
$effect(() => clickout(node, onclick));
|
|
15
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { type AutoPlacementOptions, type ComputePositionReturn } from '@floating-ui/dom';
|
|
2
|
-
type PopoverElement = HTMLElement;
|
|
3
|
-
type OnChangeParams = ComputePositionReturn & {
|
|
4
|
-
dx: number;
|
|
5
|
-
dy: number;
|
|
6
|
-
};
|
|
7
|
-
type OnMountCallback = (p: OnChangeParams) => void;
|
|
8
|
-
export type PopoverParams = AutoPlacementOptions & {
|
|
9
|
-
open?: boolean;
|
|
10
|
-
target?: HTMLElement;
|
|
11
|
-
reference?: HTMLElement;
|
|
12
|
-
offset?: number;
|
|
13
|
-
animate?: (node: PopoverElement, params: ComputePositionReturn) => void;
|
|
14
|
-
onMount?: () => void | (() => void);
|
|
15
|
-
onDestroy?: () => void;
|
|
16
|
-
onChange?: OnMountCallback;
|
|
17
|
-
};
|
|
18
|
-
export declare function popover(node: HTMLElement, fn: () => PopoverParams): void;
|
|
19
|
-
export {};
|