@svelte-atoms/core 1.0.0-alpha.27 → 1.0.0-alpha.29
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 +852 -645
- package/dist/components/accordion/accordion-root.svelte +61 -61
- package/dist/components/accordion/item/accordion-item-body.svelte +42 -42
- package/dist/components/accordion/item/accordion-item-header.svelte +50 -50
- package/dist/components/accordion/item/accordion-item-indicator.svelte +50 -50
- package/dist/components/accordion/item/accordion-item-root.svelte +65 -65
- package/dist/components/alert/alert-actions.svelte +43 -42
- package/dist/components/alert/alert-close-button.svelte +70 -72
- package/dist/components/alert/alert-content.svelte +43 -42
- package/dist/components/alert/alert-description.svelte +42 -41
- package/dist/components/alert/alert-icon.svelte +47 -46
- package/dist/components/alert/alert-root.svelte +103 -102
- package/dist/components/alert/alert-title.svelte +42 -41
- package/dist/components/alert/alert.stories.svelte +384 -23
- package/dist/components/alert/alert.stories.svelte.d.ts +2 -5
- package/dist/components/atom/html-atom.svelte +207 -201
- package/dist/components/atom/html-atom.svelte.d.ts +1 -1
- package/dist/components/atom/snippet-renderer.svelte +5 -0
- package/dist/components/atom/snippet-renderer.svelte.d.ts +5 -0
- package/dist/components/avatar/avatar.stories.svelte.d.ts +1 -1
- package/dist/components/badge/badge.stories.svelte.d.ts +1 -1
- package/dist/components/breadcrumb/breadcrumb.stories.svelte.d.ts +1 -1
- package/dist/components/button/button.stories.svelte +17 -14
- package/dist/components/calendar/atoms.d.ts +5 -0
- package/dist/components/calendar/atoms.js +5 -0
- package/dist/components/calendar/bond.svelte.d.ts +72 -0
- package/dist/components/calendar/bond.svelte.js +132 -0
- package/dist/components/calendar/calendar-body.svelte +107 -0
- package/dist/components/calendar/calendar-body.svelte.d.ts +8 -0
- package/dist/components/calendar/calendar-day.svelte +96 -0
- package/dist/components/calendar/calendar-day.svelte.d.ts +4 -0
- package/dist/components/calendar/calendar-header.svelte +29 -0
- package/dist/components/calendar/calendar-header.svelte.d.ts +6 -0
- package/dist/components/calendar/calendar-root.svelte +206 -0
- package/dist/components/calendar/calendar-root.svelte.d.ts +8 -0
- package/dist/components/calendar/calendar-week-day.svelte +34 -0
- package/dist/components/calendar/calendar-week-day.svelte.d.ts +9 -0
- package/dist/components/calendar/calendar.css +26 -0
- package/dist/components/calendar/calendar.stories.svelte +31 -0
- package/dist/components/calendar/calendar.stories.svelte.d.ts +26 -0
- package/dist/components/calendar/index.d.ts +4 -0
- package/dist/components/calendar/index.js +4 -0
- package/dist/components/calendar/runes.svelte.d.ts +3 -0
- package/dist/components/calendar/runes.svelte.js +25 -0
- package/dist/components/calendar/types.d.ts +62 -0
- package/dist/components/calendar/types.js +1 -0
- package/dist/components/card/card-body.svelte +39 -39
- package/dist/components/card/card-description.svelte +41 -41
- package/dist/components/card/card-footer.svelte +41 -41
- package/dist/components/card/card-header.svelte +41 -41
- package/dist/components/card/card-media.svelte +41 -41
- package/dist/components/card/card-root.svelte +91 -91
- package/dist/components/card/card-subtitle.svelte +41 -41
- package/dist/components/card/card-title.svelte +45 -45
- package/dist/components/collapsible/collapsible-body.svelte +39 -39
- package/dist/components/collapsible/collapsible-header.svelte +39 -39
- package/dist/components/collapsible/collapsible-indicator.svelte +50 -50
- package/dist/components/collapsible/collapsible-root.svelte +66 -66
- package/dist/components/combobox/combobox-root.svelte +65 -65
- package/dist/components/container/container.stories.svelte.d.ts +1 -1
- package/dist/components/contextmenu/contextmenu-trigger.svelte.d.ts +1 -1
- package/dist/components/datagrid/bond.svelte.d.ts +2 -2
- package/dist/components/datagrid/datagrid-body.svelte +37 -37
- package/dist/components/datagrid/datagrid-checkbox.svelte +101 -101
- package/dist/components/datagrid/datagrid-footer.svelte +34 -34
- package/dist/components/datagrid/datagrid-header.svelte +49 -49
- package/dist/components/datagrid/datagrid-root.svelte +2 -2
- package/dist/components/datagrid/datagrid.css +5 -47
- package/dist/components/datagrid/td/datagrid-td.svelte +66 -66
- package/dist/components/datagrid/th/datagrid-th.svelte +106 -106
- package/dist/components/datagrid/tr/datagrid-tr.svelte +88 -88
- package/dist/components/datagrid/types.d.ts +1 -1
- package/dist/components/date-picker/atoms.d.ts +3 -0
- package/dist/components/date-picker/atoms.js +3 -0
- package/dist/components/date-picker/bond.svelte.d.ts +67 -0
- package/dist/components/date-picker/bond.svelte.js +174 -0
- package/dist/components/date-picker/date-picker-calendar.svelte +67 -0
- package/dist/components/date-picker/date-picker-calendar.svelte.d.ts +4 -0
- package/dist/components/date-picker/date-picker-header.svelte +100 -0
- package/dist/components/date-picker/date-picker-header.svelte.d.ts +4 -0
- package/dist/components/date-picker/date-picker-months.svelte +142 -0
- package/dist/components/date-picker/date-picker-months.svelte.d.ts +4 -0
- package/dist/components/date-picker/date-picker-root.svelte +95 -0
- package/dist/components/date-picker/date-picker-root.svelte.d.ts +4 -0
- package/dist/components/date-picker/date-picker-years.svelte +205 -0
- package/dist/components/date-picker/date-picker-years.svelte.d.ts +4 -0
- package/dist/components/date-picker/date-picker.stories.svelte +42 -0
- package/dist/components/date-picker/date-picker.stories.svelte.d.ts +3 -0
- package/dist/components/date-picker/index.d.ts +3 -0
- package/dist/components/date-picker/index.js +3 -0
- package/dist/components/date-picker/types.d.ts +53 -0
- package/dist/components/date-picker/types.js +1 -0
- package/dist/components/dialog/dialog-body.svelte +39 -39
- package/dist/components/dialog/dialog-close-button.svelte +58 -58
- package/dist/components/dialog/dialog-content.svelte +1 -1
- package/dist/components/dialog/dialog-description.svelte +40 -40
- package/dist/components/dialog/dialog-footer.svelte +39 -39
- package/dist/components/dialog/dialog-header.svelte +39 -39
- package/dist/components/dialog/dialog-root.svelte +110 -110
- package/dist/components/dialog/dialog-title.svelte +41 -41
- package/dist/components/drawer/drawer-backdrop.svelte +38 -38
- package/dist/components/drawer/drawer-body.svelte +42 -42
- package/dist/components/drawer/drawer-content.svelte +42 -42
- package/dist/components/drawer/drawer-description.svelte +44 -44
- package/dist/components/drawer/drawer-footer.svelte +41 -41
- package/dist/components/drawer/drawer-header.svelte +43 -43
- package/dist/components/drawer/drawer-root.svelte +93 -93
- package/dist/components/drawer/drawer-title.svelte +44 -44
- package/dist/components/dropdown/dropdown-query.svelte +54 -54
- package/dist/components/dropdown/dropdown-root.svelte +59 -59
- package/dist/components/dropdown/dropdown-trigger.svelte +41 -41
- package/dist/components/dropdown/dropdown-value.svelte +60 -60
- package/dist/components/element/types.d.ts +1 -1
- package/dist/components/form/bond.svelte.d.ts +1 -1
- package/dist/components/form/field/field-control.svelte +48 -48
- package/dist/components/form/field/field-label.svelte +24 -24
- package/dist/components/form/field/field-root.svelte +59 -59
- package/dist/components/icon/icon.svelte +44 -44
- package/dist/components/image/image.stories.svelte.d.ts +1 -1
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.js +4 -0
- package/dist/components/input/input-control.svelte +103 -103
- package/dist/components/label/label.svelte +25 -25
- package/dist/components/lazy/index.d.ts +1 -0
- package/dist/components/lazy/index.js +1 -0
- package/dist/components/lazy/lazy.stories.svelte +35 -0
- package/dist/components/lazy/lazy.stories.svelte.d.ts +19 -0
- package/dist/components/lazy/lazy.svelte +28 -0
- package/dist/components/lazy/lazy.svelte.d.ts +5 -0
- package/dist/components/lazy/types.d.ts +10 -0
- package/dist/components/lazy/types.js +1 -0
- package/dist/components/menu/menu-list.svelte +40 -39
- package/dist/components/menu/menu-list.svelte.d.ts +1 -0
- package/dist/components/popover/popover-arrow.svelte +111 -111
- package/dist/components/popover/popover-content.svelte +178 -139
- package/dist/components/popover/popover-root.svelte +16 -17
- package/dist/components/popover/popover.stories.svelte +0 -15
- package/dist/components/portal/portal-root.svelte +83 -83
- package/dist/components/portal/teleport.svelte +50 -50
- package/dist/components/qr-code/index.d.ts +2 -0
- package/dist/components/qr-code/index.js +2 -0
- package/dist/components/qr-code/qr-code.stories.svelte +27 -0
- package/dist/components/qr-code/qr-code.stories.svelte.d.ts +26 -0
- package/dist/components/qr-code/qr-code.svelte +75 -0
- package/dist/components/qr-code/qr-code.svelte.d.ts +4 -0
- package/dist/components/qr-code/types.d.ts +14 -0
- package/dist/components/qr-code/types.js +1 -0
- package/dist/components/radio/radio.svelte +109 -109
- package/dist/components/radio/types.svelte.d.ts +1 -1
- package/dist/components/scrollable/scrollable-container.svelte +82 -82
- package/dist/components/scrollable/scrollable-content.svelte +41 -41
- package/dist/components/scrollable/scrollable-root.svelte +100 -100
- package/dist/components/scrollable/scrollable-thumb.svelte +75 -75
- package/dist/components/scrollable/scrollable-track.svelte +59 -59
- package/dist/components/scrollable/scrollable.stories.svelte.d.ts +1 -1
- package/dist/components/sidebar/bond.svelte.d.ts +0 -5
- package/dist/components/sidebar/bond.svelte.js +1 -12
- package/dist/components/sidebar/sidebar-content.svelte +39 -39
- package/dist/components/sidebar/sidebar-content.svelte.d.ts +2 -2
- package/dist/components/sidebar/sidebar-root.svelte +41 -68
- package/dist/components/sidebar/sidebar-root.svelte.d.ts +2 -2
- package/dist/components/sidebar/sidebar.stories.svelte +54 -52
- package/dist/components/sidebar/types.d.ts +6 -6
- package/dist/components/tabs/tab/tab-body.svelte +52 -52
- package/dist/components/tabs/tab/tab-description.svelte +41 -41
- package/dist/components/tabs/tab/tab-header.svelte +71 -71
- package/dist/components/tabs/tab/tab-root.svelte +86 -86
- package/dist/components/toast/toast-description.svelte +38 -38
- package/dist/components/toast/toast-root.svelte +61 -61
- package/dist/components/toast/toast-title.svelte +35 -35
- package/dist/components/tree/tree-body.svelte +39 -39
- package/dist/components/tree/tree-header.svelte +54 -54
- package/dist/components/tree/tree-indicator.svelte +40 -40
- package/dist/components/tree/tree-root.svelte +65 -65
- package/dist/components/virtual/virtual-root.svelte +239 -239
- package/dist/context/preset.svelte.d.ts +1 -1
- package/dist/icons/icon-arrow-down.svelte.d.ts +1 -1
- package/dist/icons/icon-checkmark.svelte.d.ts +1 -1
- package/dist/icons/icon-close.svelte.d.ts +1 -1
- package/dist/icons/icon-more-vert.svelte.d.ts +1 -1
- package/dist/runes/container.svelte.d.ts +2 -2
- package/dist/shared/bond.svelte.d.ts +1 -1
- package/dist/utils/state.d.ts +1 -1
- package/dist/utils/state.js +2 -1
- package/llm/variants.md +650 -103
- package/package.json +465 -437
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
<script lang="ts" generics="E extends keyof HTMLElementTagNameMap = 'p', B extends Base = Base">
|
|
2
|
-
import type { TabDescriptionProps } from '../types';
|
|
3
|
-
import { HtmlAtom, type Base } from '../../atom';
|
|
4
|
-
import { TabBond } from './bond.svelte';
|
|
5
|
-
|
|
6
|
-
const bond = TabBond.get();
|
|
7
|
-
|
|
8
|
-
let {
|
|
9
|
-
class: klass = '',
|
|
10
|
-
as = 'p' as E,
|
|
11
|
-
children,
|
|
12
|
-
onmount = undefined,
|
|
13
|
-
ondestroy = undefined,
|
|
14
|
-
animate = undefined,
|
|
15
|
-
enter = undefined,
|
|
16
|
-
exit = undefined,
|
|
17
|
-
initial = undefined,
|
|
18
|
-
...restProps
|
|
19
|
-
}: TabDescriptionProps<E, B> = $props();
|
|
20
|
-
|
|
21
|
-
const descriptionProps = $derived({
|
|
22
|
-
...bond?.description(),
|
|
23
|
-
...restProps
|
|
24
|
-
});
|
|
25
|
-
</script>
|
|
26
|
-
|
|
27
|
-
<HtmlAtom
|
|
28
|
-
{bond}
|
|
29
|
-
preset="tab.description"
|
|
30
|
-
class={['border-border', '$preset', klass]}
|
|
31
|
-
onmount={onmount?.bind(bond.state)}
|
|
32
|
-
ondestroy={ondestroy?.bind(bond.state)}
|
|
33
|
-
enter={enter?.bind(bond.state)}
|
|
34
|
-
exit={exit?.bind(bond.state)}
|
|
35
|
-
initial={initial?.bind(bond.state)}
|
|
36
|
-
animate={animate?.bind(bond.state)}
|
|
37
|
-
{as}
|
|
38
|
-
{...descriptionProps}
|
|
39
|
-
>
|
|
40
|
-
{@render children?.({ tab: bond })}
|
|
41
|
-
</HtmlAtom>
|
|
1
|
+
<script lang="ts" generics="E extends keyof HTMLElementTagNameMap = 'p', B extends Base = Base">
|
|
2
|
+
import type { TabDescriptionProps } from '../types';
|
|
3
|
+
import { HtmlAtom, type Base } from '../../atom';
|
|
4
|
+
import { TabBond } from './bond.svelte';
|
|
5
|
+
|
|
6
|
+
const bond = TabBond.get();
|
|
7
|
+
|
|
8
|
+
let {
|
|
9
|
+
class: klass = '',
|
|
10
|
+
as = 'p' as E,
|
|
11
|
+
children,
|
|
12
|
+
onmount = undefined,
|
|
13
|
+
ondestroy = undefined,
|
|
14
|
+
animate = undefined,
|
|
15
|
+
enter = undefined,
|
|
16
|
+
exit = undefined,
|
|
17
|
+
initial = undefined,
|
|
18
|
+
...restProps
|
|
19
|
+
}: TabDescriptionProps<E, B> = $props();
|
|
20
|
+
|
|
21
|
+
const descriptionProps = $derived({
|
|
22
|
+
...bond?.description(),
|
|
23
|
+
...restProps
|
|
24
|
+
});
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<HtmlAtom
|
|
28
|
+
{bond}
|
|
29
|
+
preset="tab.description"
|
|
30
|
+
class={['border-border', '$preset', klass]}
|
|
31
|
+
onmount={onmount?.bind(bond.state)}
|
|
32
|
+
ondestroy={ondestroy?.bind(bond.state)}
|
|
33
|
+
enter={enter?.bind(bond.state)}
|
|
34
|
+
exit={exit?.bind(bond.state)}
|
|
35
|
+
initial={initial?.bind(bond.state)}
|
|
36
|
+
animate={animate?.bind(bond.state)}
|
|
37
|
+
{as}
|
|
38
|
+
{...descriptionProps}
|
|
39
|
+
>
|
|
40
|
+
{@render children?.({ tab: bond })}
|
|
41
|
+
</HtmlAtom>
|
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
<script
|
|
2
|
-
lang="ts"
|
|
3
|
-
generics="E extends keyof HTMLElementTagNameMap = 'button', B extends Base = Base"
|
|
4
|
-
>
|
|
5
|
-
import type { TabHeaderProps } from '../types';
|
|
6
|
-
import { TabBond } from './bond.svelte';
|
|
7
|
-
import { HtmlAtom, type Base } from '../../atom';
|
|
8
|
-
|
|
9
|
-
const bond = TabBond.get();
|
|
10
|
-
|
|
11
|
-
const isActive = $derived(bond?.state.isActive);
|
|
12
|
-
const isDisabled = $derived(bond?.state.props.disabled);
|
|
13
|
-
|
|
14
|
-
let {
|
|
15
|
-
class: klass = '',
|
|
16
|
-
as = 'button' as E,
|
|
17
|
-
children,
|
|
18
|
-
onpointerdown,
|
|
19
|
-
onmount = undefined,
|
|
20
|
-
ondestroy = undefined,
|
|
21
|
-
animate = undefined,
|
|
22
|
-
enter = undefined,
|
|
23
|
-
exit = undefined,
|
|
24
|
-
initial = undefined,
|
|
25
|
-
...restProps
|
|
26
|
-
}: TabHeaderProps = $props();
|
|
27
|
-
|
|
28
|
-
const headerProps = $derived({
|
|
29
|
-
...bond?.header(),
|
|
30
|
-
...restProps
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
function handlePointerDown(ev: PointerEvent) {
|
|
34
|
-
if (isDisabled) return;
|
|
35
|
-
|
|
36
|
-
onpointerdown?.(ev, { tab: bond });
|
|
37
|
-
|
|
38
|
-
if (ev.defaultPrevented) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
bond?.state.select();
|
|
43
|
-
}
|
|
44
|
-
</script>
|
|
45
|
-
|
|
46
|
-
<HtmlAtom
|
|
47
|
-
{bond}
|
|
48
|
-
preset="tab.header"
|
|
49
|
-
as="button"
|
|
50
|
-
class={[
|
|
51
|
-
'border-border text-foreground/60 hover:text-foreground/80 active:text-foreground/100 bg-foreground/0 hover:bg-foreground/5 active:bg-foreground/10 flex cursor-pointer items-center px-2 py-2 text-sm font-medium transition-colors duration-100',
|
|
52
|
-
isActive && 'text-primary bg-accent/10 hover:bg-accent/15 active:bg-accent/20',
|
|
53
|
-
isDisabled && 'opacity-50',
|
|
54
|
-
'$preset',
|
|
55
|
-
klass
|
|
56
|
-
]}
|
|
57
|
-
onmount={onmount?.bind(bond.state)}
|
|
58
|
-
ondestroy={ondestroy?.bind(bond.state)}
|
|
59
|
-
enter={enter?.bind(bond.state)}
|
|
60
|
-
exit={exit?.bind(bond.state)}
|
|
61
|
-
initial={initial?.bind(bond.state)}
|
|
62
|
-
animate={animate?.bind(bond.state)}
|
|
63
|
-
type="button"
|
|
64
|
-
disabled={isDisabled}
|
|
65
|
-
onpointerdown={handlePointerDown}
|
|
66
|
-
{...headerProps}
|
|
67
|
-
>
|
|
68
|
-
{@render children?.({
|
|
69
|
-
tab: bond
|
|
70
|
-
})}
|
|
71
|
-
</HtmlAtom>
|
|
1
|
+
<script
|
|
2
|
+
lang="ts"
|
|
3
|
+
generics="E extends keyof HTMLElementTagNameMap = 'button', B extends Base = Base"
|
|
4
|
+
>
|
|
5
|
+
import type { TabHeaderProps } from '../types';
|
|
6
|
+
import { TabBond } from './bond.svelte';
|
|
7
|
+
import { HtmlAtom, type Base } from '../../atom';
|
|
8
|
+
|
|
9
|
+
const bond = TabBond.get();
|
|
10
|
+
|
|
11
|
+
const isActive = $derived(bond?.state.isActive);
|
|
12
|
+
const isDisabled = $derived(bond?.state.props.disabled);
|
|
13
|
+
|
|
14
|
+
let {
|
|
15
|
+
class: klass = '',
|
|
16
|
+
as = 'button' as E,
|
|
17
|
+
children,
|
|
18
|
+
onpointerdown,
|
|
19
|
+
onmount = undefined,
|
|
20
|
+
ondestroy = undefined,
|
|
21
|
+
animate = undefined,
|
|
22
|
+
enter = undefined,
|
|
23
|
+
exit = undefined,
|
|
24
|
+
initial = undefined,
|
|
25
|
+
...restProps
|
|
26
|
+
}: TabHeaderProps = $props();
|
|
27
|
+
|
|
28
|
+
const headerProps = $derived({
|
|
29
|
+
...bond?.header(),
|
|
30
|
+
...restProps
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
function handlePointerDown(ev: PointerEvent) {
|
|
34
|
+
if (isDisabled) return;
|
|
35
|
+
|
|
36
|
+
onpointerdown?.(ev, { tab: bond });
|
|
37
|
+
|
|
38
|
+
if (ev.defaultPrevented) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
bond?.state.select();
|
|
43
|
+
}
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<HtmlAtom
|
|
47
|
+
{bond}
|
|
48
|
+
preset="tab.header"
|
|
49
|
+
as="button"
|
|
50
|
+
class={[
|
|
51
|
+
'border-border text-foreground/60 hover:text-foreground/80 active:text-foreground/100 bg-foreground/0 hover:bg-foreground/5 active:bg-foreground/10 flex cursor-pointer items-center px-2 py-2 text-sm font-medium transition-colors duration-100',
|
|
52
|
+
isActive && 'text-primary bg-accent/10 hover:bg-accent/15 active:bg-accent/20',
|
|
53
|
+
isDisabled && 'opacity-50',
|
|
54
|
+
'$preset',
|
|
55
|
+
klass
|
|
56
|
+
]}
|
|
57
|
+
onmount={onmount?.bind(bond.state)}
|
|
58
|
+
ondestroy={ondestroy?.bind(bond.state)}
|
|
59
|
+
enter={enter?.bind(bond.state)}
|
|
60
|
+
exit={exit?.bind(bond.state)}
|
|
61
|
+
initial={initial?.bind(bond.state)}
|
|
62
|
+
animate={animate?.bind(bond.state)}
|
|
63
|
+
type="button"
|
|
64
|
+
disabled={isDisabled}
|
|
65
|
+
onpointerdown={handlePointerDown}
|
|
66
|
+
{...headerProps}
|
|
67
|
+
>
|
|
68
|
+
{@render children?.({
|
|
69
|
+
tab: bond
|
|
70
|
+
})}
|
|
71
|
+
</HtmlAtom>
|
|
@@ -1,86 +1,86 @@
|
|
|
1
|
-
<script
|
|
2
|
-
lang="ts"
|
|
3
|
-
generics="D, E extends keyof HTMLElementTagNameMap = 'div', B extends Base = Base"
|
|
4
|
-
>
|
|
5
|
-
import { nanoid } from 'nanoid';
|
|
6
|
-
import { animate as motion } from 'motion';
|
|
7
|
-
import { defineProperty, defineState } from '../../../utils';
|
|
8
|
-
import { TabBond, TabBondState, type TabBondProps } from './bond.svelte';
|
|
9
|
-
import { TabsBond } from '../bond.svelte';
|
|
10
|
-
import { type Base } from '../../atom';
|
|
11
|
-
import { Stack } from '../../stack';
|
|
12
|
-
|
|
13
|
-
const tabsBond = TabsBond.get();
|
|
14
|
-
|
|
15
|
-
const headerElement = $derived(tabsBond?.elements.header);
|
|
16
|
-
|
|
17
|
-
let {
|
|
18
|
-
class: klass = '',
|
|
19
|
-
value = nanoid(),
|
|
20
|
-
disabled = false,
|
|
21
|
-
data = undefined,
|
|
22
|
-
factory = _factory,
|
|
23
|
-
children,
|
|
24
|
-
onmount = undefined,
|
|
25
|
-
ondestroy = undefined,
|
|
26
|
-
animate = _animate,
|
|
27
|
-
enter = undefined,
|
|
28
|
-
exit = undefined,
|
|
29
|
-
initial = undefined,
|
|
30
|
-
...restProps
|
|
31
|
-
} = $props();
|
|
32
|
-
|
|
33
|
-
const bondProps = defineState<TabBondProps<D>>([
|
|
34
|
-
defineProperty('value', () => value),
|
|
35
|
-
defineProperty('disabled', () => disabled),
|
|
36
|
-
defineProperty('data', () => data)
|
|
37
|
-
]);
|
|
38
|
-
|
|
39
|
-
const bond = factory(bondProps).share();
|
|
40
|
-
|
|
41
|
-
const rootProps = $derived({
|
|
42
|
-
...bond?.root(),
|
|
43
|
-
...restProps
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
const isActive = $derived(bond.state.isActive ?? false);
|
|
47
|
-
|
|
48
|
-
const unmount = bond.mount();
|
|
49
|
-
$effect(() => unmount);
|
|
50
|
-
|
|
51
|
-
function _factory(props: typeof bondProps) {
|
|
52
|
-
const bondState = new TabBondState(() => props);
|
|
53
|
-
|
|
54
|
-
return new TabBond(bondState);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function _animate(node: HTMLElement) {
|
|
58
|
-
motion(node, { opacity: +isActive }, { duration: 0 });
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export function getBond() {
|
|
62
|
-
return bond;
|
|
63
|
-
}
|
|
64
|
-
</script>
|
|
65
|
-
|
|
66
|
-
{#if headerElement && children}
|
|
67
|
-
<Stack.Item
|
|
68
|
-
{bond}
|
|
69
|
-
preset="tab"
|
|
70
|
-
class={[
|
|
71
|
-
'border-border tab-root flex flex-col',
|
|
72
|
-
!isActive && 'pointer-events-none',
|
|
73
|
-
'$preset',
|
|
74
|
-
klass
|
|
75
|
-
]}
|
|
76
|
-
onmount={onmount?.bind(bond.state)}
|
|
77
|
-
ondestroy={ondestroy?.bind(bond.state)}
|
|
78
|
-
enter={enter?.bind(bond.state)}
|
|
79
|
-
exit={exit?.bind(bond.state)}
|
|
80
|
-
initial={initial?.bind(bond.state)}
|
|
81
|
-
animate={animate?.bind(bond.state)}
|
|
82
|
-
{...rootProps}
|
|
83
|
-
>
|
|
84
|
-
{@render children?.({ tab: bond })}
|
|
85
|
-
</Stack.Item>
|
|
86
|
-
{/if}
|
|
1
|
+
<script
|
|
2
|
+
lang="ts"
|
|
3
|
+
generics="D, E extends keyof HTMLElementTagNameMap = 'div', B extends Base = Base"
|
|
4
|
+
>
|
|
5
|
+
import { nanoid } from 'nanoid';
|
|
6
|
+
import { animate as motion } from 'motion';
|
|
7
|
+
import { defineProperty, defineState } from '../../../utils';
|
|
8
|
+
import { TabBond, TabBondState, type TabBondProps } from './bond.svelte';
|
|
9
|
+
import { TabsBond } from '../bond.svelte';
|
|
10
|
+
import { type Base } from '../../atom';
|
|
11
|
+
import { Stack } from '../../stack';
|
|
12
|
+
|
|
13
|
+
const tabsBond = TabsBond.get();
|
|
14
|
+
|
|
15
|
+
const headerElement = $derived(tabsBond?.elements.header);
|
|
16
|
+
|
|
17
|
+
let {
|
|
18
|
+
class: klass = '',
|
|
19
|
+
value = nanoid(),
|
|
20
|
+
disabled = false,
|
|
21
|
+
data = undefined,
|
|
22
|
+
factory = _factory,
|
|
23
|
+
children,
|
|
24
|
+
onmount = undefined,
|
|
25
|
+
ondestroy = undefined,
|
|
26
|
+
animate = _animate,
|
|
27
|
+
enter = undefined,
|
|
28
|
+
exit = undefined,
|
|
29
|
+
initial = undefined,
|
|
30
|
+
...restProps
|
|
31
|
+
} = $props();
|
|
32
|
+
|
|
33
|
+
const bondProps = defineState<TabBondProps<D>>([
|
|
34
|
+
defineProperty('value', () => value),
|
|
35
|
+
defineProperty('disabled', () => disabled),
|
|
36
|
+
defineProperty('data', () => data)
|
|
37
|
+
]);
|
|
38
|
+
|
|
39
|
+
const bond = factory(bondProps).share();
|
|
40
|
+
|
|
41
|
+
const rootProps = $derived({
|
|
42
|
+
...bond?.root(),
|
|
43
|
+
...restProps
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const isActive = $derived(bond.state.isActive ?? false);
|
|
47
|
+
|
|
48
|
+
const unmount = bond.mount();
|
|
49
|
+
$effect(() => unmount);
|
|
50
|
+
|
|
51
|
+
function _factory(props: typeof bondProps) {
|
|
52
|
+
const bondState = new TabBondState(() => props);
|
|
53
|
+
|
|
54
|
+
return new TabBond(bondState);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function _animate(node: HTMLElement) {
|
|
58
|
+
motion(node, { opacity: +isActive }, { duration: 0 });
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function getBond() {
|
|
62
|
+
return bond;
|
|
63
|
+
}
|
|
64
|
+
</script>
|
|
65
|
+
|
|
66
|
+
{#if headerElement && children}
|
|
67
|
+
<Stack.Item
|
|
68
|
+
{bond}
|
|
69
|
+
preset="tab"
|
|
70
|
+
class={[
|
|
71
|
+
'border-border tab-root flex flex-col',
|
|
72
|
+
!isActive && 'pointer-events-none',
|
|
73
|
+
'$preset',
|
|
74
|
+
klass
|
|
75
|
+
]}
|
|
76
|
+
onmount={onmount?.bind(bond.state)}
|
|
77
|
+
ondestroy={ondestroy?.bind(bond.state)}
|
|
78
|
+
enter={enter?.bind(bond.state)}
|
|
79
|
+
exit={exit?.bind(bond.state)}
|
|
80
|
+
initial={initial?.bind(bond.state)}
|
|
81
|
+
animate={animate?.bind(bond.state)}
|
|
82
|
+
{...rootProps}
|
|
83
|
+
>
|
|
84
|
+
{@render children?.({ tab: bond })}
|
|
85
|
+
</Stack.Item>
|
|
86
|
+
{/if}
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
<script lang="ts" generics="T extends keyof HTMLElementTagNameMap">
|
|
2
|
-
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
-
import { HtmlAtom } from '../atom';
|
|
4
|
-
import type { ToastDescriptionProps } from './types';
|
|
5
|
-
import { ToastBond } from './bond';
|
|
6
|
-
export type { ToastDescriptionProps } from './types';
|
|
7
|
-
|
|
8
|
-
const bond = ToastBond.get();
|
|
9
|
-
|
|
10
|
-
let {
|
|
11
|
-
as = 'p' as T,
|
|
12
|
-
class: klass = '',
|
|
13
|
-
children = undefined,
|
|
14
|
-
onmount = undefined,
|
|
15
|
-
ondestroy = undefined,
|
|
16
|
-
animate = undefined,
|
|
17
|
-
enter = undefined,
|
|
18
|
-
exit = undefined,
|
|
19
|
-
initial = undefined,
|
|
20
|
-
...restProps
|
|
21
|
-
}: ToastDescriptionProps<T> & HTMLAttributes<HTMLElementTagNameMap[T]> = $props();
|
|
22
|
-
</script>
|
|
23
|
-
|
|
24
|
-
<HtmlAtom
|
|
25
|
-
{as}
|
|
26
|
-
{bond}
|
|
27
|
-
preset="toast.description"
|
|
28
|
-
class={['border-border', '$preset', klass]}
|
|
29
|
-
enter={enter?.bind(bond.state)}
|
|
30
|
-
exit={exit?.bind(bond.state)}
|
|
31
|
-
initial={initial?.bind(bond.state)}
|
|
32
|
-
animate={animate?.bind(bond.state)}
|
|
33
|
-
onmount={onmount?.bind(bond.state)}
|
|
34
|
-
ondestroy={ondestroy?.bind(bond.state)}
|
|
35
|
-
{...bond?.title(restProps)}
|
|
36
|
-
>
|
|
37
|
-
{@render children?.({ toast: bond })}
|
|
38
|
-
</HtmlAtom>
|
|
1
|
+
<script lang="ts" generics="T extends keyof HTMLElementTagNameMap">
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import { HtmlAtom } from '../atom';
|
|
4
|
+
import type { ToastDescriptionProps } from './types';
|
|
5
|
+
import { ToastBond } from './bond';
|
|
6
|
+
export type { ToastDescriptionProps } from './types';
|
|
7
|
+
|
|
8
|
+
const bond = ToastBond.get();
|
|
9
|
+
|
|
10
|
+
let {
|
|
11
|
+
as = 'p' as T,
|
|
12
|
+
class: klass = '',
|
|
13
|
+
children = undefined,
|
|
14
|
+
onmount = undefined,
|
|
15
|
+
ondestroy = undefined,
|
|
16
|
+
animate = undefined,
|
|
17
|
+
enter = undefined,
|
|
18
|
+
exit = undefined,
|
|
19
|
+
initial = undefined,
|
|
20
|
+
...restProps
|
|
21
|
+
}: ToastDescriptionProps<T> & HTMLAttributes<HTMLElementTagNameMap[T]> = $props();
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<HtmlAtom
|
|
25
|
+
{as}
|
|
26
|
+
{bond}
|
|
27
|
+
preset="toast.description"
|
|
28
|
+
class={['border-border', '$preset', klass]}
|
|
29
|
+
enter={enter?.bind(bond.state)}
|
|
30
|
+
exit={exit?.bind(bond.state)}
|
|
31
|
+
initial={initial?.bind(bond.state)}
|
|
32
|
+
animate={animate?.bind(bond.state)}
|
|
33
|
+
onmount={onmount?.bind(bond.state)}
|
|
34
|
+
ondestroy={ondestroy?.bind(bond.state)}
|
|
35
|
+
{...bond?.title(restProps)}
|
|
36
|
+
>
|
|
37
|
+
{@render children?.({ toast: bond })}
|
|
38
|
+
</HtmlAtom>
|
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
<script lang="ts" generics="T extends keyof HTMLElementTagNameMap">
|
|
2
|
-
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
-
import { ToastBond, ToastBondState, type ToastBondProps } from './bond';
|
|
4
|
-
import { defineProperty, defineState } from '../../utils';
|
|
5
|
-
import { HtmlAtom } from '../atom';
|
|
6
|
-
import type { ToastRootProps } from './types';
|
|
7
|
-
|
|
8
|
-
let {
|
|
9
|
-
open = $bindable(false),
|
|
10
|
-
class: klass = '',
|
|
11
|
-
disabled = false,
|
|
12
|
-
extend = {},
|
|
13
|
-
factory = _factory,
|
|
14
|
-
children = undefined,
|
|
15
|
-
onmount = undefined,
|
|
16
|
-
ondestroy = undefined,
|
|
17
|
-
animate = undefined,
|
|
18
|
-
enter = undefined,
|
|
19
|
-
exit = undefined,
|
|
20
|
-
initial = undefined,
|
|
21
|
-
...restProps
|
|
22
|
-
}: ToastRootProps<T> & HTMLAttributes<HTMLElementTagNameMap[T]> = $props();
|
|
23
|
-
|
|
24
|
-
const bondProps = defineState<ToastBondProps>(
|
|
25
|
-
[
|
|
26
|
-
defineProperty(
|
|
27
|
-
'open',
|
|
28
|
-
() => open,
|
|
29
|
-
(v) => {
|
|
30
|
-
open = v;
|
|
31
|
-
}
|
|
32
|
-
)
|
|
33
|
-
],
|
|
34
|
-
() => ({ disabled, extend })
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
const bond = factory(bondProps).share();
|
|
38
|
-
|
|
39
|
-
function _factory(props: typeof bondProps) {
|
|
40
|
-
const bondState = new ToastBondState(() => props);
|
|
41
|
-
return new ToastBond(bondState);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export function getBond() {
|
|
45
|
-
return bond;
|
|
46
|
-
}
|
|
47
|
-
</script>
|
|
48
|
-
|
|
49
|
-
<HtmlAtom
|
|
50
|
-
{bond}
|
|
51
|
-
class={['border-border', '$preset', klass]}
|
|
52
|
-
enter={enter?.bind(bond.state)}
|
|
53
|
-
exit={exit?.bind(bond.state)}
|
|
54
|
-
initial={initial?.bind(bond.state)}
|
|
55
|
-
animate={animate?.bind(bond.state)}
|
|
56
|
-
onmount={onmount?.bind(bond.state)}
|
|
57
|
-
ondestroy={ondestroy?.bind(bond.state)}
|
|
58
|
-
{...bond?.root(restProps)}
|
|
59
|
-
>
|
|
60
|
-
{@render children?.({ toast: bond })}
|
|
61
|
-
</HtmlAtom>
|
|
1
|
+
<script lang="ts" generics="T extends keyof HTMLElementTagNameMap">
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import { ToastBond, ToastBondState, type ToastBondProps } from './bond';
|
|
4
|
+
import { defineProperty, defineState } from '../../utils';
|
|
5
|
+
import { HtmlAtom } from '../atom';
|
|
6
|
+
import type { ToastRootProps } from './types';
|
|
7
|
+
|
|
8
|
+
let {
|
|
9
|
+
open = $bindable(false),
|
|
10
|
+
class: klass = '',
|
|
11
|
+
disabled = false,
|
|
12
|
+
extend = {},
|
|
13
|
+
factory = _factory,
|
|
14
|
+
children = undefined,
|
|
15
|
+
onmount = undefined,
|
|
16
|
+
ondestroy = undefined,
|
|
17
|
+
animate = undefined,
|
|
18
|
+
enter = undefined,
|
|
19
|
+
exit = undefined,
|
|
20
|
+
initial = undefined,
|
|
21
|
+
...restProps
|
|
22
|
+
}: ToastRootProps<T> & HTMLAttributes<HTMLElementTagNameMap[T]> = $props();
|
|
23
|
+
|
|
24
|
+
const bondProps = defineState<ToastBondProps>(
|
|
25
|
+
[
|
|
26
|
+
defineProperty(
|
|
27
|
+
'open',
|
|
28
|
+
() => open,
|
|
29
|
+
(v) => {
|
|
30
|
+
open = v;
|
|
31
|
+
}
|
|
32
|
+
)
|
|
33
|
+
],
|
|
34
|
+
() => ({ disabled, extend })
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
const bond = factory(bondProps).share();
|
|
38
|
+
|
|
39
|
+
function _factory(props: typeof bondProps) {
|
|
40
|
+
const bondState = new ToastBondState(() => props);
|
|
41
|
+
return new ToastBond(bondState);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function getBond() {
|
|
45
|
+
return bond;
|
|
46
|
+
}
|
|
47
|
+
</script>
|
|
48
|
+
|
|
49
|
+
<HtmlAtom
|
|
50
|
+
{bond}
|
|
51
|
+
class={['border-border', '$preset', klass]}
|
|
52
|
+
enter={enter?.bind(bond.state)}
|
|
53
|
+
exit={exit?.bind(bond.state)}
|
|
54
|
+
initial={initial?.bind(bond.state)}
|
|
55
|
+
animate={animate?.bind(bond.state)}
|
|
56
|
+
onmount={onmount?.bind(bond.state)}
|
|
57
|
+
ondestroy={ondestroy?.bind(bond.state)}
|
|
58
|
+
{...bond?.root(restProps)}
|
|
59
|
+
>
|
|
60
|
+
{@render children?.({ toast: bond })}
|
|
61
|
+
</HtmlAtom>
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
<script lang="ts" generics="T extends keyof HTMLElementTagNameMap">
|
|
2
|
-
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
-
import { HtmlAtom } from '../atom';
|
|
4
|
-
import { ToastBond } from './bond';
|
|
5
|
-
import type { ToastTitleProps } from './types';
|
|
6
|
-
|
|
7
|
-
const bond = ToastBond.get();
|
|
8
|
-
|
|
9
|
-
let {
|
|
10
|
-
class: klass = '',
|
|
11
|
-
children = undefined,
|
|
12
|
-
onmount = undefined,
|
|
13
|
-
ondestroy = undefined,
|
|
14
|
-
animate = undefined,
|
|
15
|
-
enter = undefined,
|
|
16
|
-
exit = undefined,
|
|
17
|
-
initial = undefined,
|
|
18
|
-
...restProps
|
|
19
|
-
}: ToastTitleProps<T> & HTMLAttributes<HTMLElementTagNameMap[T]> = $props();
|
|
20
|
-
</script>
|
|
21
|
-
|
|
22
|
-
<HtmlAtom
|
|
23
|
-
{bond}
|
|
24
|
-
preset="toast.title"
|
|
25
|
-
class={['border-border', '$preset', klass]}
|
|
26
|
-
enter={enter?.bind(bond.state)}
|
|
27
|
-
exit={exit?.bind(bond.state)}
|
|
28
|
-
initial={initial?.bind(bond.state)}
|
|
29
|
-
animate={animate?.bind(bond.state)}
|
|
30
|
-
onmount={onmount?.bind(bond.state)}
|
|
31
|
-
ondestroy={ondestroy?.bind(bond.state)}
|
|
32
|
-
{...bond?.title(restProps)}
|
|
33
|
-
>
|
|
34
|
-
{@render children?.({ toast: bond })}
|
|
35
|
-
</HtmlAtom>
|
|
1
|
+
<script lang="ts" generics="T extends keyof HTMLElementTagNameMap">
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import { HtmlAtom } from '../atom';
|
|
4
|
+
import { ToastBond } from './bond';
|
|
5
|
+
import type { ToastTitleProps } from './types';
|
|
6
|
+
|
|
7
|
+
const bond = ToastBond.get();
|
|
8
|
+
|
|
9
|
+
let {
|
|
10
|
+
class: klass = '',
|
|
11
|
+
children = undefined,
|
|
12
|
+
onmount = undefined,
|
|
13
|
+
ondestroy = undefined,
|
|
14
|
+
animate = undefined,
|
|
15
|
+
enter = undefined,
|
|
16
|
+
exit = undefined,
|
|
17
|
+
initial = undefined,
|
|
18
|
+
...restProps
|
|
19
|
+
}: ToastTitleProps<T> & HTMLAttributes<HTMLElementTagNameMap[T]> = $props();
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<HtmlAtom
|
|
23
|
+
{bond}
|
|
24
|
+
preset="toast.title"
|
|
25
|
+
class={['border-border', '$preset', klass]}
|
|
26
|
+
enter={enter?.bind(bond.state)}
|
|
27
|
+
exit={exit?.bind(bond.state)}
|
|
28
|
+
initial={initial?.bind(bond.state)}
|
|
29
|
+
animate={animate?.bind(bond.state)}
|
|
30
|
+
onmount={onmount?.bind(bond.state)}
|
|
31
|
+
ondestroy={ondestroy?.bind(bond.state)}
|
|
32
|
+
{...bond?.title(restProps)}
|
|
33
|
+
>
|
|
34
|
+
{@render children?.({ toast: bond })}
|
|
35
|
+
</HtmlAtom>
|