lapikit 0.0.0-insiders.e877f7f → 0.0.0-insiders.fb2e87e

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 (99) hide show
  1. package/dist/actions/index.d.ts +1 -0
  2. package/dist/actions/index.js +1 -0
  3. package/dist/assets/icons/arrow-down.svelte +10 -0
  4. package/dist/assets/icons/arrow-down.svelte.d.ts +26 -0
  5. package/dist/assets/icons/arrow-up.svelte +10 -0
  6. package/dist/assets/icons/arrow-up.svelte.d.ts +26 -0
  7. package/dist/assets/icons/close-fill.svelte +10 -0
  8. package/dist/assets/icons/close-fill.svelte.d.ts +26 -0
  9. package/dist/components/accordion/accordion.css +113 -0
  10. package/dist/components/accordion/accordion.svelte +37 -0
  11. package/dist/components/accordion/accordion.svelte.d.ts +4 -0
  12. package/dist/components/accordion/accordion.svelte.js +24 -0
  13. package/dist/components/accordion/modules/accordion-item.svelte +94 -0
  14. package/dist/components/accordion/modules/accordion-item.svelte.d.ts +4 -0
  15. package/dist/components/accordion/types.d.ts +33 -0
  16. package/dist/components/accordion/types.js +1 -0
  17. package/dist/components/alert/alert.css +127 -0
  18. package/dist/components/alert/alert.svelte +89 -0
  19. package/dist/components/alert/alert.svelte.d.ts +4 -0
  20. package/dist/components/alert/types.d.ts +28 -0
  21. package/dist/components/alert/types.js +1 -0
  22. package/dist/components/app/app.css +16 -0
  23. package/dist/components/app/app.svelte +31 -2
  24. package/dist/components/appbar/appbar.css +48 -0
  25. package/dist/components/appbar/appbar.svelte +41 -0
  26. package/dist/components/appbar/appbar.svelte.d.ts +4 -0
  27. package/dist/components/appbar/types.d.ts +15 -0
  28. package/dist/components/appbar/types.js +1 -0
  29. package/dist/components/aspect-ratio/aspect-ratio.css +19 -0
  30. package/dist/components/aspect-ratio/aspect-ratio.svelte +48 -0
  31. package/dist/components/aspect-ratio/aspect-ratio.svelte.d.ts +4 -0
  32. package/dist/components/aspect-ratio/types.d.ts +5 -0
  33. package/dist/components/aspect-ratio/types.js +1 -0
  34. package/dist/components/avatar/avatar.css +109 -0
  35. package/dist/components/avatar/avatar.svelte +46 -0
  36. package/dist/components/avatar/avatar.svelte.d.ts +4 -0
  37. package/dist/components/avatar/types.d.ts +22 -0
  38. package/dist/components/avatar/types.js +1 -0
  39. package/dist/components/button/button.css +4 -4
  40. package/dist/components/button/button.svelte +1 -1
  41. package/dist/components/card/card.css +109 -0
  42. package/dist/components/card/card.svelte +50 -0
  43. package/dist/components/card/card.svelte.d.ts +4 -0
  44. package/dist/components/card/types.d.ts +18 -0
  45. package/dist/components/card/types.js +1 -0
  46. package/dist/components/chip/chip.css +199 -0
  47. package/dist/components/chip/chip.svelte +118 -0
  48. package/dist/components/chip/chip.svelte.d.ts +4 -0
  49. package/dist/components/chip/types.d.ts +30 -0
  50. package/dist/components/chip/types.js +1 -0
  51. package/dist/components/dialog/dialog.css +134 -0
  52. package/dist/components/dialog/dialog.svelte +67 -0
  53. package/dist/components/dialog/dialog.svelte.d.ts +4 -0
  54. package/dist/components/dialog/types.d.ts +24 -0
  55. package/dist/components/dialog/types.js +1 -0
  56. package/dist/components/index.d.ts +15 -0
  57. package/dist/components/index.js +15 -0
  58. package/dist/components/list/list.css +195 -0
  59. package/dist/components/list/list.svelte +46 -0
  60. package/dist/components/list/list.svelte.d.ts +4 -0
  61. package/dist/components/list/modules/list-item.svelte +68 -0
  62. package/dist/components/list/modules/list-item.svelte.d.ts +4 -0
  63. package/dist/components/list/types.d.ts +36 -0
  64. package/dist/components/list/types.js +1 -0
  65. package/dist/components/modal/modal.css +140 -0
  66. package/dist/components/modal/modal.svelte +112 -0
  67. package/dist/components/modal/modal.svelte.d.ts +4 -0
  68. package/dist/components/modal/types.d.ts +26 -0
  69. package/dist/components/modal/types.js +1 -0
  70. package/dist/components/separator/separator.css +46 -0
  71. package/dist/components/separator/separator.svelte +37 -0
  72. package/dist/components/separator/separator.svelte.d.ts +4 -0
  73. package/dist/components/separator/types.d.ts +11 -0
  74. package/dist/components/separator/types.js +1 -0
  75. package/dist/components/spacer/spacer.css +3 -0
  76. package/dist/components/spacer/spacer.svelte +7 -0
  77. package/dist/components/spacer/spacer.svelte.d.ts +4 -0
  78. package/dist/components/spacer/types.d.ts +4 -0
  79. package/dist/components/spacer/types.js +1 -0
  80. package/dist/components/toolbar/toolbar.css +129 -0
  81. package/dist/components/toolbar/toolbar.svelte +47 -0
  82. package/dist/components/toolbar/toolbar.svelte.d.ts +4 -0
  83. package/dist/components/toolbar/types.d.ts +27 -0
  84. package/dist/components/toolbar/types.js +1 -0
  85. package/dist/internal/assets.svelte.d.ts +1 -0
  86. package/dist/internal/assets.svelte.js +11 -0
  87. package/dist/internal/index.d.ts +1 -0
  88. package/dist/internal/index.js +1 -0
  89. package/dist/internal/scroll.d.ts +1 -0
  90. package/dist/internal/scroll.js +6 -0
  91. package/dist/internal/unit.d.ts +1 -0
  92. package/dist/internal/unit.js +11 -0
  93. package/dist/preset.js +1 -1
  94. package/dist/stores/index.d.ts +9 -3
  95. package/dist/stores/index.js +27 -3
  96. package/dist/style/css.js +3 -0
  97. package/dist/style/parser/device.js +31 -19
  98. package/dist/style/variable.css +12 -0
  99. package/package.json +6 -2
@@ -0,0 +1,195 @@
1
+ .kit-list {
2
+ --list-color: var(--on, var(--kit-on-neutral));
3
+ --list-background: var(--base, var(--kit-neutral));
4
+ --list-radius: var(--shape, var(--kit-radius-md));
5
+ display: flex;
6
+ }
7
+
8
+ .kit-list.kit-list--nav {
9
+ padding-top: 8px;
10
+ padding-bottom: 8px;
11
+ padding-inline: 8px;
12
+ }
13
+
14
+ /* orientation */
15
+ .kit-list[breakpoint]kit-list--orientation-vertical {
16
+ flex-direction: column;
17
+ width: 100%;
18
+ }
19
+ .kit-list[breakpoint]kit-list--orientation-horizontal {
20
+ flex-direction: row;
21
+ width: fit-content;
22
+ }
23
+ .kit-list[breakpoint]kit-list--orientation-horizontal .kit-list-item {
24
+ justify-content: center;
25
+ }
26
+
27
+ /* size */
28
+ .kit-list[breakpoint]kit-list--size-xs {
29
+ --list-height: 1.75rem;
30
+ --list-multiplier-y: 2;
31
+ --list-gap: 0.25rem;
32
+ font-size: 0.75rem;
33
+ }
34
+
35
+ .kit-list[breakpoint]kit-list--size-sm {
36
+ --list-height: 2rem;
37
+ --list-multiplier-y: 3;
38
+ --list-gap: 0.5rem;
39
+ font-size: 0.875rem;
40
+ }
41
+
42
+ .kit-list[breakpoint]kit-list--size-md {
43
+ --list-height: 2.25rem;
44
+ --list-multiplier-y: 4;
45
+ --list-gap: 0.5rem;
46
+ font-size: 0.875rem;
47
+ }
48
+
49
+ .kit-list[breakpoint]kit-list--size-lg {
50
+ --list-height: 2.5rem;
51
+ --list-multiplier-y: 5;
52
+ --list-gap: 0.5rem;
53
+ font-size: 1rem;
54
+ }
55
+
56
+ .kit-list[breakpoint]kit-list--size-xl {
57
+ --list-height: 2.75rem;
58
+ --list-multiplier-y: 6;
59
+ --list-gap: 0.675rem;
60
+ font-size: 1.125rem;
61
+ }
62
+
63
+ /* density */
64
+ .kit-list[breakpoint]kit-list--density-default .kit-list-item {
65
+ height: calc(var(--list-height));
66
+ min-width: calc(var(--list-height));
67
+ --list-spacing-x: 0;
68
+ --list-spacing-y: calc(var(--kit-spacing) * var(--list-multiplier-y));
69
+ }
70
+
71
+ .kit-list[breakpoint]kit-list--density-compact .kit-list-item {
72
+ height: calc(var(--list-height) - 0.25rem);
73
+ min-width: calc(var(--list-height) - 0.25rem);
74
+ --list-spacing-x: 0;
75
+ --list-spacing-y: calc(var(--kit-spacing) * var(--list-multiplier-y) - 0.25rem);
76
+ }
77
+
78
+ .kit-list[breakpoint]kit-list--density-comfortable .kit-list-item {
79
+ height: calc(var(--list-height) + 0.25rem);
80
+ min-width: calc(var(--list-height) + 0.25rem);
81
+ --list-spacing-x: 0;
82
+ --list-spacing-y: calc(var(--kit-spacing) * var(--list-multiplier-y) + 0.25rem);
83
+ }
84
+
85
+ /* variant */
86
+ .kit-list[breakpoint]kit-list--variant-outline .kit-list-item {
87
+ --list-item-color: var(--base, var(--list-background, var(--kit-neutral)));
88
+ background-color: transparent;
89
+ border: 1px solid currentColor;
90
+ }
91
+
92
+ .kit-list[breakpoint]kit-list--variant-text .kit-list-item {
93
+ --list-item-color: var(--base, var(--list-background, var(--kit-neutral)));
94
+ background-color: transparent;
95
+ border-color: transparent;
96
+ }
97
+
98
+ .kit-list[breakpoint]kit-list--variant-dash .kit-list-item {
99
+ --list-item-color: var(--base, var(--list-background, var(--kit-neutral)));
100
+ background-color: transparent;
101
+ border: 1px dashed currentColor;
102
+ }
103
+
104
+ .kit-list[breakpoint]kit-list--variant-link .kit-list-item {
105
+ --list-item-color: var(--base, var(--list-background, var(--kit-neutral)));
106
+ background-color: transparent;
107
+ border-color: transparent;
108
+ }
109
+
110
+ /* events */
111
+ .kit-list:not([class*='list--variant-']) .kit-list-item.kit-list-item--active {
112
+ background-color: color-mix(in oklab, var(--list-item-background) 90%, var(--kit-scrim));
113
+ border-color: color-mix(in oklab, var(--list-item-background) 90%, var(--kit-scrim));
114
+ }
115
+ .kit-list[class*='list--variant-'] .kit-list-item.kit-list-item--active {
116
+ background-color: color-mix(in oklab, currentColor 15%, transparent);
117
+ border-color: color-mix(in oklab, currentColor 15%, transparent);
118
+ }
119
+
120
+ .kit-list:not([class*='list--variant-']) .kit-list-item:not(div):hover {
121
+ background-color: color-mix(in oklab, var(--list-item-background) 85%, var(--kit-scrim));
122
+ border-color: color-mix(in oklab, var(--list-item-background) 85%, var(--kit-scrim));
123
+ }
124
+ .kit-list[class*='list--variant-'] .kit-list-item:not(div):hover {
125
+ background-color: color-mix(in oklab, currentColor 25%, transparent);
126
+ }
127
+
128
+ /* disabled */
129
+ .kit-list .kit-list-item.kit-list-item--disabled,
130
+ .kit-list .kit-list-item[disabled],
131
+ .kit-list.kit-list--disabled .kit-list-item {
132
+ pointer-events: none;
133
+ user-select: none;
134
+ cursor: default;
135
+ }
136
+ .kit-list:not([class*='list--variant-']) .kit-list-item.kit-list-item--disabled {
137
+ color: color-mix(in oklab, var(--list-item-color) 40%, transparent) !important;
138
+ background-color: color-mix(in oklab, var(--list-item-background) 70%, transparent) !important;
139
+ border-color: color-mix(in oklab, var(--list-item-background) 70%, transparent) !important;
140
+ }
141
+ .kit-list:not([class*='list--variant-']) .kit-list-item.kit-list-item--disabled i:before {
142
+ color: color-mix(in oklab, var(--list-item-color) 40%, transparent) !important;
143
+ }
144
+ .kit-list[class*='list--variant-'] .kit-list-item.kit-list-item--disabled,
145
+ .kit-list[class*='list--variant-'] .kit-list-item.kit-list-item--disabled i:before {
146
+ color: color-mix(in oklab, var(--list-item-background) 40%, transparent) !important;
147
+ }
148
+
149
+ /* list item */
150
+ .kit-list .kit-list-item {
151
+ --list-item-color: var(--on, var(--list-color, var(--kit-on-neutral)));
152
+ --list-item-background: var(--base, var(--list-background, var(--kit-neutral)));
153
+ --list-item-radius: var(--shape, var(--list-radius, var(--kit-radius-md)));
154
+
155
+ display: inline-flex;
156
+ padding-top: var(--list-spacing-x);
157
+ padding-bottom: var(--list-spacing-x);
158
+ padding-right: var(--list-spacing-y);
159
+ padding-left: var(--list-spacing-y);
160
+ align-items: center;
161
+ white-space: nowrap;
162
+ gap: var(--list-gap);
163
+
164
+ border-width: 1px;
165
+ border-style: solid;
166
+ border-radius: var(--list-item-radius);
167
+
168
+ /* theme */
169
+ color: var(--list-item-color);
170
+ background-color: var(--list-item-background);
171
+ border-color: var(--list-item-background);
172
+ }
173
+
174
+ .kit-list .kit-list-item:not(div) {
175
+ cursor: pointer;
176
+ }
177
+
178
+ .kit-list .kit-list-item > .kit-list-item-content {
179
+ display: flex;
180
+ }
181
+
182
+ .kit-list .kit-list-item.kit-list-item--append:not(.kit-list-item--prepend) {
183
+ display: grid;
184
+ grid-template-columns: auto 1fr;
185
+ }
186
+
187
+ .kit-list .kit-list-item.kit-list-item--prepend:not(.kit-list-item--append) {
188
+ display: grid;
189
+ grid-template-columns: 1fr auto;
190
+ }
191
+
192
+ .kit-list .kit-list-item.kit-list-item--prepend.kit-list-item--append {
193
+ display: grid;
194
+ grid-template-columns: auto 1fr auto;
195
+ }
@@ -0,0 +1,46 @@
1
+ <script lang="ts">
2
+ import { getAssets } from '../../internal/index.js';
3
+ import type { ListProps } from './types.js';
4
+
5
+ let {
6
+ children,
7
+ ref = $bindable(),
8
+ is = 'div',
9
+ dark,
10
+ light,
11
+ orientation = 'vertical',
12
+ background,
13
+ color,
14
+ rounded,
15
+ size = 'md',
16
+ density = 'default',
17
+ variant,
18
+ nav,
19
+ ...rest
20
+ }: ListProps = $props();
21
+
22
+ const assets = getAssets();
23
+ </script>
24
+
25
+ <svelte:element
26
+ this={is}
27
+ bind:this={ref}
28
+ {...rest}
29
+ class={[
30
+ 'kit-list',
31
+ light && 'light',
32
+ dark && 'dark',
33
+ orientation && assets.className('list', 'orientation', orientation),
34
+ size && assets.className('list', 'size', size),
35
+ variant && assets.className('list', 'variant', variant),
36
+ density && assets.className('list', 'density', density),
37
+ nav && 'kit-list--nav',
38
+ rest.class
39
+ ]}
40
+ role="listbox"
41
+ style:--base={assets.color(background)}
42
+ style:--on={assets.color(color)}
43
+ style:--shape={assets.shape(rounded)}
44
+ >
45
+ {@render children?.()}
46
+ </svelte:element>
@@ -0,0 +1,4 @@
1
+ import type { ListProps } from './types.js';
2
+ declare const List: import("svelte").Component<ListProps, {}, "ref">;
3
+ type List = ReturnType<typeof List>;
4
+ export default List;
@@ -0,0 +1,68 @@
1
+ <script lang="ts">
2
+ import { getAssets } from '../../../internal/index.js';
3
+ import type { ListItemProps } from '../types.js';
4
+
5
+ let {
6
+ children,
7
+ append,
8
+ prepend,
9
+ ref = $bindable(),
10
+ is = 'div',
11
+ dark,
12
+ light,
13
+ background,
14
+ color,
15
+ rounded,
16
+ disabled,
17
+ active,
18
+ href,
19
+ ...rest
20
+ }: ListItemProps = $props();
21
+
22
+ const assets = getAssets();
23
+
24
+ $effect(() => {
25
+ const refProps = { ...rest };
26
+ if (refProps?.onclick) is = 'button';
27
+ });
28
+ </script>
29
+
30
+ <svelte:element
31
+ this={href ? 'a' : is}
32
+ bind:this={ref}
33
+ {...rest}
34
+ href={href && !disabled ? href : undefined}
35
+ class={[
36
+ 'kit-list-item',
37
+ light && 'light',
38
+ dark && 'dark',
39
+ append && 'kit-list-item--append',
40
+ prepend && 'kit-list-item--prepend',
41
+ active && 'kit-list-item--active',
42
+ disabled && 'kit-list-item--disabled',
43
+ rest.class
44
+ ]}
45
+ role={is === 'button' ? 'listitem' : undefined}
46
+ tabindex={href && disabled ? -2 : 0}
47
+ aria-disabled={href ? disabled : undefined}
48
+ disabled={href ? undefined : disabled}
49
+ style:--base={assets.color(background)}
50
+ style:--on={assets.color(color)}
51
+ style:--shape={assets.shape(rounded)}
52
+ >
53
+ {#if append}
54
+ <div class="kit-list-item-content--append">
55
+ {@render append?.()}
56
+ </div>
57
+ {/if}
58
+
59
+ <div class="kit-list-item-content">
60
+ {@render children?.()}
61
+ </div>
62
+
63
+ {#if prepend}
64
+ <div class="kit-list-item-content--prepend">
65
+ {@render prepend?.()}
66
+ </div>
67
+ {/if}
68
+ </svelte:element>
@@ -0,0 +1,4 @@
1
+ import type { ListItemProps } from '../types.js';
2
+ declare const ListItem: import("svelte").Component<ListItemProps, {}, "ref">;
3
+ type ListItem = ReturnType<typeof ListItem>;
4
+ export default ListItem;
@@ -0,0 +1,36 @@
1
+ import type { Component } from '../../internal/types.js';
2
+ import type { Snippet } from 'svelte';
3
+ type ListOrientation = 'vertical' | 'horizontal';
4
+ type ListSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
5
+ type ListDensity = 'compact' | 'comfortable' | 'default';
6
+ export interface ListProps extends Component {
7
+ ref?: HTMLElement | null;
8
+ is?: 'div' | 'nav';
9
+ dark?: boolean;
10
+ light?: boolean;
11
+ size?: ListSize | {
12
+ [key: string]: ListSize;
13
+ };
14
+ variant?: 'outline' | 'text' | 'dash' | 'link';
15
+ density?: ListDensity | {
16
+ [key: string]: ListDensity;
17
+ };
18
+ nav?: boolean;
19
+ orientation?: ListOrientation | {
20
+ [key: string]: ListOrientation;
21
+ };
22
+ }
23
+ export interface ListItemProps extends Component {
24
+ ref?: HTMLElement | null;
25
+ is?: 'div' | 'a' | 'button';
26
+ href?: string;
27
+ dark?: boolean;
28
+ light?: boolean;
29
+ append?: Snippet;
30
+ prepend?: Snippet;
31
+ color?: string;
32
+ background?: string;
33
+ active?: boolean;
34
+ disabled?: boolean;
35
+ }
36
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,140 @@
1
+ .kit-modal {
2
+ width: 100%;
3
+ height: 100%;
4
+ }
5
+
6
+ .kit-modal-container {
7
+ --modal-color: var(--on, var(--kit-on-neutral));
8
+ --modal-background: var(--base, var(--kit-neutral));
9
+ --modal-radius: var(--shape, var(--kit-radius-md));
10
+ --modal-translate-x: -50%;
11
+ --modal-translate-y: -50%;
12
+
13
+ position: fixed;
14
+ overflow-y: auto;
15
+ z-index: 9100;
16
+ width: 100%;
17
+ height: 100%;
18
+ padding-top: var(--modal-spacing-x);
19
+ padding-bottom: var(--modal-spacing-x);
20
+ padding-right: var(--modal-spacing-y);
21
+ padding-left: var(--modal-spacing-y);
22
+
23
+ /* theme */
24
+ color: var(--modal-color);
25
+ background-color: var(--modal-background);
26
+ border-color: var(--modal-background);
27
+ }
28
+
29
+ .kit-modal.kit-modal--contain {
30
+ position: absolute;
31
+ top: 0;
32
+ }
33
+
34
+ .kit-modal.kit-modal--contain .kit-overlay {
35
+ position: absolute;
36
+ }
37
+
38
+ .kit-modal.kit-modal--contain .kit-modal-container {
39
+ position: absolute;
40
+ }
41
+
42
+ /* size */
43
+ .kit-modal [breakpoint]kit-modal-container--size-xs {
44
+ max-width: var(--kit-modal-size-xs);
45
+ max-height: calc(100% - 3rem);
46
+ height: fit-content;
47
+ margin: 0 auto;
48
+ top: 50%;
49
+ left: 50%;
50
+ bottom: initial;
51
+ translate: var(--modal-translate-x) var(--modal-translate-y);
52
+ border-radius: var(--modal-radius);
53
+ }
54
+ .kit-modal [breakpoint]kit-modal-container--size-sm {
55
+ max-width: var(--kit-modal-size-sm);
56
+ max-height: calc(100% - 3rem);
57
+ height: fit-content;
58
+ margin: 0 auto;
59
+ top: 50%;
60
+ left: 50%;
61
+ bottom: initial;
62
+ translate: var(--modal-translate-x) var(--modal-translate-y);
63
+ border-radius: var(--modal-radius);
64
+ }
65
+ .kit-modal [breakpoint]kit-modal-container--size-md {
66
+ max-width: var(--kit-modal-size-md);
67
+ max-height: calc(100% - 3rem);
68
+ height: fit-content;
69
+ margin: 0 auto;
70
+ top: 50%;
71
+ left: 50%;
72
+ bottom: initial;
73
+ translate: var(--modal-translate-x) var(--modal-translate-y);
74
+ border-radius: var(--modal-radius);
75
+ }
76
+ .kit-modal [breakpoint]kit-modal-container--size-lg {
77
+ max-width: var(--kit-modal-size-lg);
78
+ max-height: calc(100% - 3rem);
79
+ height: fit-content;
80
+ margin: 0 auto;
81
+ top: 50%;
82
+ left: 50%;
83
+ bottom: initial;
84
+ translate: var(--modal-translate-x) var(--modal-translate-y);
85
+ border-radius: var(--modal-radius);
86
+ }
87
+ .kit-modal [breakpoint]kit-modal-container--size-xl {
88
+ max-width: var(--kit-modal-size-xl);
89
+ max-height: calc(100% - 3rem);
90
+ height: fit-content;
91
+ margin: 0 auto;
92
+ top: 50%;
93
+ left: 50%;
94
+ bottom: initial;
95
+ translate: var(--modal-translate-x) var(--modal-translate-y);
96
+ border-radius: var(--modal-radius);
97
+ }
98
+ .kit-modal [breakpoint]kit-modal-container--size-full {
99
+ max-width: 100%;
100
+ max-height: calc(100% - 3rem);
101
+ margin: 0 auto;
102
+ bottom: 0;
103
+ translate: 0 0;
104
+ left: 0;
105
+ top: initial;
106
+ height: 100%;
107
+ border-radius: var(--modal-radius) var(--modal-radius) 0 0;
108
+ }
109
+
110
+ /* density */
111
+ .kit-modal [breakpoint]kit-modal-container--density-default {
112
+ --modal-spacing-x: 0.5rem;
113
+ --modal-spacing-y: 0.5rem;
114
+ }
115
+
116
+ .kit-modal [breakpoint]kit-modal-container--density-compact {
117
+ --modal-spacing-x: 0.25rem;
118
+ --modal-spacing-y: 0.25rem;
119
+ }
120
+
121
+ .kit-modal [breakpoint]kit-modal-container--density-comfortable {
122
+ --modal-spacing-x: 0.75rem;
123
+ --modal-spacing-y: 0.75rem;
124
+ }
125
+
126
+ /* position */
127
+ .kit-modal [breakpoint]kit-modal-container--position-bottom {
128
+ --modal-translate-y: 0;
129
+ bottom: 0;
130
+ top: initial;
131
+ }
132
+
133
+ .kit-modal [breakpoint]kit-modal-container--position-top {
134
+ --modal-translate-y: 0;
135
+ top: 0;
136
+ }
137
+
138
+ .kit-modal [breakpoint]kit-modal-container--position-center {
139
+ margin: auto;
140
+ }
@@ -0,0 +1,112 @@
1
+ <script lang="ts">
2
+ // import { disabledScroll } from '../../internal/index.js';
3
+ import { getAssets } from '../../internal/index.js';
4
+ import { modalOpen, modalStack, popModal, pushModal, setOpenModal } from '../../stores/index.js';
5
+ import { onDestroy } from 'svelte';
6
+ import type { ModalProps } from './types.js';
7
+ import { get } from 'svelte/store';
8
+
9
+ const modalId = crypto.randomUUID();
10
+ let wasPushed = $state(false);
11
+
12
+ let {
13
+ children,
14
+ ref = $bindable(),
15
+ open = $bindable(),
16
+ contain,
17
+ size = 'md',
18
+ persistent,
19
+ dark,
20
+ light,
21
+ classContent,
22
+ color,
23
+ background,
24
+ position = 'center',
25
+ rounded,
26
+ density = 'default',
27
+ closeWithEsc,
28
+ ...rest
29
+ }: ModalProps = $props();
30
+
31
+ const assets = getAssets();
32
+
33
+ $effect(() => {
34
+ if (open && !wasPushed) {
35
+ pushModal(modalId);
36
+ wasPushed = true;
37
+ } else if (!open && wasPushed) {
38
+ popModal(modalId);
39
+ wasPushed = false;
40
+ }
41
+ });
42
+
43
+ onDestroy(() => {
44
+ if (wasPushed) popModal(modalId);
45
+ });
46
+
47
+ $effect(() => {
48
+ if (open !== undefined && !contain)
49
+ setOpenModal(open ? (persistent ? 'persistent' : open) : open);
50
+ });
51
+
52
+ $effect(() => {
53
+ if ($modalOpen === false && !contain) open = false;
54
+ });
55
+
56
+ $effect(() => {
57
+ if (!closeWithEsc || persistent || !open) return;
58
+
59
+ const onKeyDown = (event: KeyboardEvent) => {
60
+ const stack = get(modalStack);
61
+ const isTop = stack[stack.length - 1] === modalId;
62
+
63
+ if (event.key === 'Escape' && isTop) {
64
+ event.preventDefault();
65
+ open = false;
66
+ }
67
+ };
68
+
69
+ document.addEventListener('keydown', onKeyDown);
70
+ return () => {
71
+ document.removeEventListener('keydown', onKeyDown);
72
+ };
73
+ });
74
+
75
+ const handleClose = () => {
76
+ if (!persistent) open = false;
77
+ };
78
+ </script>
79
+
80
+ {#if open}
81
+ <div
82
+ bind:this={ref}
83
+ class={['kit-modal', contain && 'kit-modal--contain', rest.class]}
84
+ role="dialog"
85
+ >
86
+ <!-- svelte-ignore a11y_no_static_element_interactions -->
87
+ {#if contain}
88
+ <!-- svelte-ignore a11y_click_events_have_key_events -->
89
+ <div
90
+ class={['kit-overlay', persistent && 'kit-overlay--persistent']}
91
+ onclick={() => handleClose()}
92
+ ></div>
93
+ {/if}
94
+
95
+ <div
96
+ class={[
97
+ 'kit-modal-container',
98
+ classContent,
99
+ light && 'light',
100
+ dark && 'dark',
101
+ size && assets.className('modal-container', 'size', size),
102
+ density && assets.className('modal-container', 'density', density),
103
+ position && assets.className('modal-container', 'position', position)
104
+ ]}
105
+ style:--base={assets.color(background)}
106
+ style:--on={assets.color(color)}
107
+ style:--shape={assets.shape(rounded)}
108
+ >
109
+ {@render children?.()}
110
+ </div>
111
+ </div>
112
+ {/if}
@@ -0,0 +1,4 @@
1
+ import type { ModalProps } from './types.js';
2
+ declare const Modal: import("svelte").Component<ModalProps, {}, "ref" | "open">;
3
+ type Modal = ReturnType<typeof Modal>;
4
+ export default Modal;
@@ -0,0 +1,26 @@
1
+ import type { Component } from '../../internal/types.js';
2
+ type ModalSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
3
+ type ModalPosition = 'bottom' | 'center' | 'top';
4
+ type ModalDensity = 'compact' | 'comfortable' | 'default';
5
+ export interface ModalProps extends Component {
6
+ ref?: HTMLDivElement;
7
+ open?: boolean;
8
+ classContent?: string | string[] | undefined;
9
+ size?: ModalSize | {
10
+ [key: string]: ModalSize;
11
+ };
12
+ persistent?: boolean;
13
+ position?: ModalPosition | {
14
+ [key: string]: ModalPosition;
15
+ };
16
+ dark?: boolean;
17
+ light?: boolean;
18
+ color?: string;
19
+ background?: string;
20
+ density?: ModalDensity | {
21
+ [key: string]: ModalDensity;
22
+ };
23
+ contain?: boolean;
24
+ closeWithEsc?: boolean;
25
+ }
26
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,46 @@
1
+ .kit-separator {
2
+ --separator-opacity: var(--opacity, 0.12);
3
+ --separator-color: var(--base, var(--kit-scrim));
4
+
5
+ display: block;
6
+ flex: 1 1 100%;
7
+ height: 0px;
8
+ max-height: 0px;
9
+ opacity: var(--separator-opacity);
10
+ transition: inherit;
11
+ border-color: var(--separator-color);
12
+ transition: border-color 0.5s;
13
+ border-style: solid;
14
+ }
15
+
16
+ .kit-separator:not(.kit-separator--orientation-vertical) {
17
+ border-width: var(--border-top-width, thin) 0 0 0;
18
+ }
19
+
20
+ .kit-separator--orientation-vertical {
21
+ align-self: stretch;
22
+ border-width: 0 thin 0 0;
23
+ display: inline-flex;
24
+ height: auto;
25
+ margin-left: 0px;
26
+ max-height: 100%;
27
+ max-width: 0px;
28
+ vertical-align: text-bottom;
29
+ width: 0px;
30
+ border-width: 0 var(--border-right-width, thin) 0 0;
31
+ }
32
+
33
+ .kit-separator--inset:not(.kit-separator--orientation-vertical) {
34
+ max-width: calc(100% - 4.5rem);
35
+ margin-inline-start: 4.5rem;
36
+ }
37
+
38
+ .kit-separator--inset.kit-separator--orientation-vertical {
39
+ margin-bottom: 0.5rem;
40
+ margin-top: 0.5rem;
41
+ max-height: calc(100% - 1rem);
42
+ }
43
+
44
+ .kit-separator:not(.kit-separator--orientation-vertical) {
45
+ width: 100%;
46
+ }