@svelte-atoms/core 1.0.0-alpha.28 → 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.
Files changed (74) hide show
  1. package/README.md +1 -5
  2. package/dist/components/alert/alert-actions.svelte +43 -43
  3. package/dist/components/alert/alert-close-button.svelte +70 -70
  4. package/dist/components/alert/alert-content.svelte +43 -43
  5. package/dist/components/alert/alert-description.svelte +42 -42
  6. package/dist/components/alert/alert-icon.svelte +47 -47
  7. package/dist/components/alert/alert-root.svelte +103 -103
  8. package/dist/components/alert/alert-title.svelte +42 -42
  9. package/dist/components/alert/alert.stories.svelte +401 -401
  10. package/dist/components/atom/html-atom.svelte +6 -4
  11. package/dist/components/atom/html-atom.svelte.d.ts +1 -1
  12. package/dist/components/atom/snippet-renderer.svelte +5 -5
  13. package/dist/components/button/button.stories.svelte +60 -60
  14. package/dist/components/calendar/calendar-body.svelte +107 -107
  15. package/dist/components/calendar/calendar-day.svelte +0 -1
  16. package/dist/components/calendar/calendar-header.svelte +2 -6
  17. package/dist/components/calendar/calendar-header.svelte.d.ts +0 -1
  18. package/dist/components/calendar/calendar-root.svelte +0 -2
  19. package/dist/components/calendar/calendar-week-day.svelte +34 -34
  20. package/dist/components/calendar/calendar.css +26 -26
  21. package/dist/components/calendar/calendar.stories.svelte +0 -5
  22. package/dist/components/calendar/calendar.stories.svelte.d.ts +24 -4
  23. package/dist/components/datagrid/datagrid-root.svelte +59 -59
  24. package/dist/components/datagrid/datagrid.css +5 -47
  25. package/dist/components/datagrid/types.d.ts +1 -1
  26. package/dist/components/date-picker/atoms.d.ts +0 -4
  27. package/dist/components/date-picker/atoms.js +0 -4
  28. package/dist/components/date-picker/date-picker-calendar.svelte +34 -9
  29. package/dist/components/date-picker/date-picker-calendar.svelte.d.ts +2 -5
  30. package/dist/components/date-picker/date-picker-header.svelte +59 -64
  31. package/dist/components/date-picker/date-picker-header.svelte.d.ts +2 -5
  32. package/dist/components/date-picker/date-picker-months.svelte +36 -44
  33. package/dist/components/date-picker/date-picker-months.svelte.d.ts +2 -5
  34. package/dist/components/date-picker/date-picker-root.svelte +3 -2
  35. package/dist/components/date-picker/date-picker-root.svelte.d.ts +2 -15
  36. package/dist/components/date-picker/date-picker-years.svelte +88 -97
  37. package/dist/components/date-picker/date-picker-years.svelte.d.ts +2 -5
  38. package/dist/components/date-picker/date-picker.stories.svelte +6 -15
  39. package/dist/components/date-picker/types.d.ts +53 -1
  40. package/dist/components/dialog/dialog-content.svelte +62 -62
  41. package/dist/components/element/html-element.svelte +85 -85
  42. package/dist/components/element/types.d.ts +1 -1
  43. package/dist/components/index.d.ts +1 -0
  44. package/dist/components/index.js +1 -0
  45. package/dist/components/lazy/index.d.ts +1 -0
  46. package/dist/components/lazy/index.js +1 -0
  47. package/dist/components/lazy/lazy.stories.svelte +35 -0
  48. package/dist/components/lazy/lazy.stories.svelte.d.ts +19 -0
  49. package/dist/components/lazy/lazy.svelte +28 -0
  50. package/dist/components/lazy/lazy.svelte.d.ts +5 -0
  51. package/dist/components/lazy/types.d.ts +10 -0
  52. package/dist/components/lazy/types.js +1 -0
  53. package/dist/components/menu/menu-list.svelte +40 -39
  54. package/dist/components/menu/menu-list.svelte.d.ts +1 -0
  55. package/dist/components/popover/popover-content.svelte +178 -178
  56. package/dist/components/popover/popover-root.svelte +48 -48
  57. package/dist/components/popover/popover.stories.svelte +52 -52
  58. package/dist/components/qr-code/index.d.ts +1 -0
  59. package/dist/components/qr-code/index.js +1 -0
  60. package/dist/components/qr-code/qr-code.stories.svelte +4 -1
  61. package/dist/components/qr-code/qr-code.svelte +65 -15
  62. package/dist/components/qr-code/qr-code.svelte.d.ts +2 -4
  63. package/dist/components/qr-code/types.d.ts +14 -0
  64. package/dist/components/qr-code/types.js +1 -0
  65. package/dist/components/sidebar/bond.svelte.d.ts +0 -5
  66. package/dist/components/sidebar/bond.svelte.js +1 -12
  67. package/dist/components/sidebar/sidebar-content.svelte +39 -39
  68. package/dist/components/sidebar/sidebar-content.svelte.d.ts +2 -2
  69. package/dist/components/sidebar/sidebar-root.svelte +41 -68
  70. package/dist/components/sidebar/sidebar-root.svelte.d.ts +2 -2
  71. package/dist/components/sidebar/sidebar.stories.svelte +54 -52
  72. package/dist/components/sidebar/types.d.ts +6 -6
  73. package/llm/variants.md +1259 -1261
  74. package/package.json +2 -1
package/README.md CHANGED
@@ -14,11 +14,7 @@
14
14
 
15
15
  ### 🧱 **Bond Architecture**
16
16
 
17
- Built around the concept of "Bonds" - self-contained, reusable state management classes that encapsulate component state and DOM interactions. Each component uses the Bond pattern for consistent, predictable behavior across complex interactions. Simple components like Button don't require the Bond pattern as they have minimal state management needs.
18
-
19
- ### 🔗 **Context-Driven Communication**
20
-
21
- Components seamlessly communicate through Svelte's context API using standardized static methods (`Bond.get()` / `Bond.set()`) of the Bond class, enabling powerful parent-child relationships without prop drilling.
17
+ Self-contained state management classes that encapsulate component logic and DOM interactions. Bonds communicate through Svelte's context API using standardized `Bond.get()` / `Bond.set()` methods, enabling parent-child relationships without prop drilling.
22
18
 
23
19
  ### ♿ **Accessibility First**
24
20
 
@@ -1,43 +1,43 @@
1
- <script lang="ts" generics="E extends keyof HTMLElementTagNameMap = 'div', B extends Base = Base">
2
- import type { HTMLAttributes } from 'svelte/elements';
3
- import { HtmlAtom, type Base } from '../atom';
4
- import { AlertBond } from './bond.svelte';
5
- import type { AlertActionsProps } from './types';
6
-
7
- type Element = HTMLElementTagNameMap[E];
8
-
9
- const bond = AlertBond.get();
10
-
11
- let {
12
- class: klass = '',
13
- preset = 'alert.actions',
14
- children = undefined,
15
- onmount = undefined,
16
- ondestroy = undefined,
17
- animate = undefined,
18
- enter = undefined,
19
- exit = undefined,
20
- initial = undefined,
21
- ...restProps
22
- }: AlertActionsProps<E, B> & HTMLAttributes<Element> = $props();
23
-
24
- const actionsProps = $derived({
25
- ...bond?.actions(),
26
- ...restProps
27
- });
28
- </script>
29
-
30
- <HtmlAtom
31
- {bond}
32
- {preset}
33
- class={['alert-actions border-border mt-3 flex items-center gap-2', '$preset', klass]}
34
- onmount={onmount?.bind(bond.state)}
35
- ondestroy={ondestroy?.bind(bond.state)}
36
- animate={animate?.bind(bond.state)}
37
- enter={enter?.bind(bond.state)}
38
- exit={exit?.bind(bond.state)}
39
- initial={initial?.bind(bond.state)}
40
- {...actionsProps}
41
- >
42
- {@render children?.({ alert: bond! })}
43
- </HtmlAtom>
1
+ <script lang="ts" generics="E extends keyof HTMLElementTagNameMap = 'div', B extends Base = Base">
2
+ import type { HTMLAttributes } from 'svelte/elements';
3
+ import { HtmlAtom, type Base } from '../atom';
4
+ import { AlertBond } from './bond.svelte';
5
+ import type { AlertActionsProps } from './types';
6
+
7
+ type Element = HTMLElementTagNameMap[E];
8
+
9
+ const bond = AlertBond.get();
10
+
11
+ let {
12
+ class: klass = '',
13
+ preset = 'alert.actions',
14
+ children = undefined,
15
+ onmount = undefined,
16
+ ondestroy = undefined,
17
+ animate = undefined,
18
+ enter = undefined,
19
+ exit = undefined,
20
+ initial = undefined,
21
+ ...restProps
22
+ }: AlertActionsProps<E, B> & HTMLAttributes<Element> = $props();
23
+
24
+ const actionsProps = $derived({
25
+ ...bond?.actions(),
26
+ ...restProps
27
+ });
28
+ </script>
29
+
30
+ <HtmlAtom
31
+ {bond}
32
+ {preset}
33
+ class={['alert-actions border-border mt-3 flex items-center gap-2', '$preset', klass]}
34
+ onmount={onmount?.bind(bond.state)}
35
+ ondestroy={ondestroy?.bind(bond.state)}
36
+ animate={animate?.bind(bond.state)}
37
+ enter={enter?.bind(bond.state)}
38
+ exit={exit?.bind(bond.state)}
39
+ initial={initial?.bind(bond.state)}
40
+ {...actionsProps}
41
+ >
42
+ {@render children?.({ alert: bond! })}
43
+ </HtmlAtom>
@@ -1,70 +1,70 @@
1
- <script
2
- lang="ts"
3
- generics="E extends keyof HTMLElementTagNameMap = 'button', B extends Base = Base"
4
- >
5
- import type { HTMLAttributes } from 'svelte/elements';
6
- import { HtmlAtom, type Base } from '../atom';
7
- import { AlertBond } from './bond.svelte';
8
- import type { AlertCloseButtonProps } from './types';
9
- import { Icon } from '../icon';
10
-
11
- type Element = HTMLElementTagNameMap[E];
12
-
13
- const bond = AlertBond.get();
14
-
15
- let {
16
- class: klass = '',
17
- as = 'button' as E,
18
- preset = 'alert.close-button',
19
- children = undefined,
20
- onmount = undefined,
21
- ondestroy = undefined,
22
- animate = undefined,
23
- enter = undefined,
24
- exit = undefined,
25
- initial = undefined,
26
- ...restProps
27
- }: AlertCloseButtonProps<E, B> & HTMLAttributes<Element> = $props();
28
-
29
- const isDismissible = $derived(bond?.state.isDismissible ?? false);
30
-
31
- const closeButtonProps = $derived({
32
- ...bond?.closeButton(),
33
- ...restProps
34
- });
35
- </script>
36
-
37
- {#if isDismissible}
38
- <HtmlAtom
39
- {as}
40
- {bond}
41
- {preset}
42
- class={[
43
- 'alert-close-button border-border flex size-6 items-center justify-center rounded p-0.5 transition-colors hover:bg-black/10 dark:hover:bg-white/10',
44
- '$preset',
45
- klass
46
- ]}
47
- onmount={onmount?.bind(bond.state)}
48
- ondestroy={ondestroy?.bind(bond.state)}
49
- animate={animate?.bind(bond.state)}
50
- enter={enter?.bind(bond.state)}
51
- exit={exit?.bind(bond.state)}
52
- initial={initial?.bind(bond.state)}
53
- {...closeButtonProps}
54
- >
55
- {#if children}
56
- {@render children({ alert: bond! })}
57
- {:else}
58
- <Icon class="h-full">
59
- <svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
60
- <path
61
- stroke-linecap="round"
62
- stroke-linejoin="round"
63
- stroke-width="2"
64
- d="M6 18L18 6M6 6l12 12"
65
- />
66
- </svg>
67
- </Icon>
68
- {/if}
69
- </HtmlAtom>
70
- {/if}
1
+ <script
2
+ lang="ts"
3
+ generics="E extends keyof HTMLElementTagNameMap = 'button', B extends Base = Base"
4
+ >
5
+ import type { HTMLAttributes } from 'svelte/elements';
6
+ import { HtmlAtom, type Base } from '../atom';
7
+ import { AlertBond } from './bond.svelte';
8
+ import type { AlertCloseButtonProps } from './types';
9
+ import { Icon } from '../icon';
10
+
11
+ type Element = HTMLElementTagNameMap[E];
12
+
13
+ const bond = AlertBond.get();
14
+
15
+ let {
16
+ class: klass = '',
17
+ as = 'button' as E,
18
+ preset = 'alert.close-button',
19
+ children = undefined,
20
+ onmount = undefined,
21
+ ondestroy = undefined,
22
+ animate = undefined,
23
+ enter = undefined,
24
+ exit = undefined,
25
+ initial = undefined,
26
+ ...restProps
27
+ }: AlertCloseButtonProps<E, B> & HTMLAttributes<Element> = $props();
28
+
29
+ const isDismissible = $derived(bond?.state.isDismissible ?? false);
30
+
31
+ const closeButtonProps = $derived({
32
+ ...bond?.closeButton(),
33
+ ...restProps
34
+ });
35
+ </script>
36
+
37
+ {#if isDismissible}
38
+ <HtmlAtom
39
+ {as}
40
+ {bond}
41
+ {preset}
42
+ class={[
43
+ 'alert-close-button border-border flex size-6 items-center justify-center rounded p-0.5 transition-colors hover:bg-black/10 dark:hover:bg-white/10',
44
+ '$preset',
45
+ klass
46
+ ]}
47
+ onmount={onmount?.bind(bond.state)}
48
+ ondestroy={ondestroy?.bind(bond.state)}
49
+ animate={animate?.bind(bond.state)}
50
+ enter={enter?.bind(bond.state)}
51
+ exit={exit?.bind(bond.state)}
52
+ initial={initial?.bind(bond.state)}
53
+ {...closeButtonProps}
54
+ >
55
+ {#if children}
56
+ {@render children({ alert: bond! })}
57
+ {:else}
58
+ <Icon class="h-full">
59
+ <svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
60
+ <path
61
+ stroke-linecap="round"
62
+ stroke-linejoin="round"
63
+ stroke-width="2"
64
+ d="M6 18L18 6M6 6l12 12"
65
+ />
66
+ </svg>
67
+ </Icon>
68
+ {/if}
69
+ </HtmlAtom>
70
+ {/if}
@@ -1,43 +1,43 @@
1
- <script lang="ts" generics="E extends keyof HTMLElementTagNameMap = 'div', B extends Base = Base">
2
- import type { HTMLAttributes } from 'svelte/elements';
3
- import { HtmlAtom, type Base } from '../atom';
4
- import { AlertBond } from './bond.svelte';
5
- import type { AlertContentProps } from './types';
6
-
7
- type Element = HTMLElementTagNameMap[E];
8
-
9
- const bond = AlertBond.get();
10
-
11
- let {
12
- class: klass = '',
13
- preset = 'alert.content',
14
- children = undefined,
15
- onmount = undefined,
16
- ondestroy = undefined,
17
- animate = undefined,
18
- enter = undefined,
19
- exit = undefined,
20
- initial = undefined,
21
- ...restProps
22
- }: AlertContentProps<E, B> & HTMLAttributes<Element> = $props();
23
-
24
- const contentProps = $derived({
25
- ...bond?.content(),
26
- ...restProps
27
- });
28
- </script>
29
-
30
- <HtmlAtom
31
- {bond}
32
- {preset}
33
- class={['alert-content border-border flex-1 space-y-1', '$preset', klass]}
34
- onmount={onmount?.bind(bond.state)}
35
- ondestroy={ondestroy?.bind(bond.state)}
36
- animate={animate?.bind(bond.state)}
37
- enter={enter?.bind(bond.state)}
38
- exit={exit?.bind(bond.state)}
39
- initial={initial?.bind(bond.state)}
40
- {...contentProps}
41
- >
42
- {@render children?.({ alert: bond! })}
43
- </HtmlAtom>
1
+ <script lang="ts" generics="E extends keyof HTMLElementTagNameMap = 'div', B extends Base = Base">
2
+ import type { HTMLAttributes } from 'svelte/elements';
3
+ import { HtmlAtom, type Base } from '../atom';
4
+ import { AlertBond } from './bond.svelte';
5
+ import type { AlertContentProps } from './types';
6
+
7
+ type Element = HTMLElementTagNameMap[E];
8
+
9
+ const bond = AlertBond.get();
10
+
11
+ let {
12
+ class: klass = '',
13
+ preset = 'alert.content',
14
+ children = undefined,
15
+ onmount = undefined,
16
+ ondestroy = undefined,
17
+ animate = undefined,
18
+ enter = undefined,
19
+ exit = undefined,
20
+ initial = undefined,
21
+ ...restProps
22
+ }: AlertContentProps<E, B> & HTMLAttributes<Element> = $props();
23
+
24
+ const contentProps = $derived({
25
+ ...bond?.content(),
26
+ ...restProps
27
+ });
28
+ </script>
29
+
30
+ <HtmlAtom
31
+ {bond}
32
+ {preset}
33
+ class={['alert-content border-border flex-1 space-y-1', '$preset', klass]}
34
+ onmount={onmount?.bind(bond.state)}
35
+ ondestroy={ondestroy?.bind(bond.state)}
36
+ animate={animate?.bind(bond.state)}
37
+ enter={enter?.bind(bond.state)}
38
+ exit={exit?.bind(bond.state)}
39
+ initial={initial?.bind(bond.state)}
40
+ {...contentProps}
41
+ >
42
+ {@render children?.({ alert: bond! })}
43
+ </HtmlAtom>
@@ -1,42 +1,42 @@
1
- <script lang="ts" generics="E extends keyof HTMLElementTagNameMap = 'div', B extends Base = Base">
2
- import { HtmlAtom, type Base } from '../atom';
3
- import { AlertBond } from './bond.svelte';
4
- export type { AlertDescriptionProps } from './types';
5
-
6
- const bond = AlertBond.get();
7
-
8
- let {
9
- class: klass = '',
10
- as = 'p' as E,
11
- preset = 'alert.description',
12
- children = undefined,
13
- onmount = undefined,
14
- ondestroy = undefined,
15
- animate = undefined,
16
- enter = undefined,
17
- exit = undefined,
18
- initial = undefined,
19
- ...restProps
20
- }: AlertDescriptionProps<E, B> = $props();
21
-
22
- const descriptionProps = $derived({
23
- ...bond?.description(),
24
- ...restProps
25
- });
26
- </script>
27
-
28
- <HtmlAtom
29
- {bond}
30
- {preset}
31
- class={['alert-description border-border mt-1 text-sm leading-relaxed', '$preset', klass]}
32
- onmount={onmount?.bind(bond.state)}
33
- ondestroy={ondestroy?.bind(bond.state)}
34
- animate={animate?.bind(bond.state)}
35
- enter={enter?.bind(bond.state)}
36
- exit={exit?.bind(bond.state)}
37
- initial={initial?.bind(bond.state)}
38
- {as}
39
- {...descriptionProps}
40
- >
41
- {@render children?.({ alert: bond! })}
42
- </HtmlAtom>
1
+ <script lang="ts" generics="E extends keyof HTMLElementTagNameMap = 'div', B extends Base = Base">
2
+ import { HtmlAtom, type Base } from '../atom';
3
+ import { AlertBond } from './bond.svelte';
4
+ export type { AlertDescriptionProps } from './types';
5
+
6
+ const bond = AlertBond.get();
7
+
8
+ let {
9
+ class: klass = '',
10
+ as = 'p' as E,
11
+ preset = 'alert.description',
12
+ children = undefined,
13
+ onmount = undefined,
14
+ ondestroy = undefined,
15
+ animate = undefined,
16
+ enter = undefined,
17
+ exit = undefined,
18
+ initial = undefined,
19
+ ...restProps
20
+ }: AlertDescriptionProps<E, B> = $props();
21
+
22
+ const descriptionProps = $derived({
23
+ ...bond?.description(),
24
+ ...restProps
25
+ });
26
+ </script>
27
+
28
+ <HtmlAtom
29
+ {bond}
30
+ {preset}
31
+ class={['alert-description border-border mt-1 text-sm leading-relaxed', '$preset', klass]}
32
+ onmount={onmount?.bind(bond.state)}
33
+ ondestroy={ondestroy?.bind(bond.state)}
34
+ animate={animate?.bind(bond.state)}
35
+ enter={enter?.bind(bond.state)}
36
+ exit={exit?.bind(bond.state)}
37
+ initial={initial?.bind(bond.state)}
38
+ {as}
39
+ {...descriptionProps}
40
+ >
41
+ {@render children?.({ alert: bond! })}
42
+ </HtmlAtom>
@@ -1,47 +1,47 @@
1
- <script lang="ts" generics="E extends keyof HTMLElementTagNameMap = 'div', B extends Base = Base">
2
- import { Icon } from '../icon';
3
- import { type Base, HtmlAtom } from '../atom';
4
- import { AlertBond } from './bond.svelte';
5
- import type { AlertIconProps } from './types';
6
-
7
- const bond = AlertBond.get();
8
-
9
- let {
10
- class: klass = '',
11
- base = Icon,
12
- preset = 'alert.icon',
13
- children = undefined,
14
- onmount = undefined,
15
- ondestroy = undefined,
16
- animate = undefined,
17
- enter = undefined,
18
- exit = undefined,
19
- initial = undefined,
20
- ...restProps
21
- }: AlertIconProps<E, B> = $props();
22
-
23
- const iconProps = $derived({
24
- ...bond?.icon(),
25
- ...restProps
26
- });
27
- </script>
28
-
29
- <HtmlAtom
30
- {bond}
31
- {base}
32
- {preset}
33
- class={[
34
- 'alert-icon border-border inline-flex aspect-square h-5 items-center justify-center rounded-full text-sm font-medium',
35
- '$preset',
36
- klass
37
- ]}
38
- onmount={onmount?.bind(bond.state)}
39
- ondestroy={ondestroy?.bind(bond.state)}
40
- animate={animate?.bind(bond.state)}
41
- enter={enter?.bind(bond.state)}
42
- exit={exit?.bind(bond.state)}
43
- initial={initial?.bind(bond.state)}
44
- {...iconProps}
45
- >
46
- {@render children?.({ alert: bond! })}
47
- </HtmlAtom>
1
+ <script lang="ts" generics="E extends keyof HTMLElementTagNameMap = 'div', B extends Base = Base">
2
+ import { Icon } from '../icon';
3
+ import { type Base, HtmlAtom } from '../atom';
4
+ import { AlertBond } from './bond.svelte';
5
+ import type { AlertIconProps } from './types';
6
+
7
+ const bond = AlertBond.get();
8
+
9
+ let {
10
+ class: klass = '',
11
+ base = Icon,
12
+ preset = 'alert.icon',
13
+ children = undefined,
14
+ onmount = undefined,
15
+ ondestroy = undefined,
16
+ animate = undefined,
17
+ enter = undefined,
18
+ exit = undefined,
19
+ initial = undefined,
20
+ ...restProps
21
+ }: AlertIconProps<E, B> = $props();
22
+
23
+ const iconProps = $derived({
24
+ ...bond?.icon(),
25
+ ...restProps
26
+ });
27
+ </script>
28
+
29
+ <HtmlAtom
30
+ {bond}
31
+ {base}
32
+ {preset}
33
+ class={[
34
+ 'alert-icon border-border inline-flex aspect-square h-5 items-center justify-center rounded-full text-sm font-medium',
35
+ '$preset',
36
+ klass
37
+ ]}
38
+ onmount={onmount?.bind(bond.state)}
39
+ ondestroy={ondestroy?.bind(bond.state)}
40
+ animate={animate?.bind(bond.state)}
41
+ enter={enter?.bind(bond.state)}
42
+ exit={exit?.bind(bond.state)}
43
+ initial={initial?.bind(bond.state)}
44
+ {...iconProps}
45
+ >
46
+ {@render children?.({ alert: bond! })}
47
+ </HtmlAtom>